Decompiled source of OneHandedRumble v1.0.0

Mods/OneHandedRumble.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using HarmonyLib;
using Il2CppRUMBLE.Input;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Players;
using Il2CppRUMBLE.Players.BootLoader;
using Il2CppRUMBLE.Players.Scaling;
using Il2CppRUMBLE.Players.Subsystems;
using Il2CppRUMBLE.Utilities;
using Il2CppTMPro;
using MelonLoader;
using OneHandedRumble;
using RumbleModUI;
using RumbleModdingAPI;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.InputSystem.XR;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(MyMod), "OneHandedRumble", "1.0.0", "Kalamart", null)]
[assembly: VerifyLoaderVersion(0, 6, 5, true)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 255, 31, 90)]
[assembly: MelonAuthorColor(255, 255, 31, 90)]
[assembly: AssemblyTitle("OneHandedRumble")]
[assembly: AssemblyDescription("Accessibility option that allows playing with only one hand")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OneHandedRumble")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("621d30a5-8fa1-4d87-9826-92c0149b033e")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace OneHandedRumble;

public static class BuildInfo
{
	public const string ModName = "OneHandedRumble";

	public const string ModVersion = "1.0.0";

	public const string Description = "Accessibility option that allows playing with only one hand";

	public const string Author = "Kalamart";

	public const string Company = "";
}
public class MyMod : MelonMod
{
	[HarmonyPatch(typeof(PlayerHandPresence), "GetHandPresenceInputForHand", new Type[] { typeof(Hand) })]
	public static class PlayerHandPresenceCopy
	{
		private static bool Prefix(Hand hand, ref PlayerHandPresence __instance, ref HandPresenceInput __result)
		{
			//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_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_0033: Unknown result type (might be due to invalid IL or missing references)
			if (tracklessMode)
			{
				return false;
			}
			if (oneHandedMode && virtualHandId == hand)
			{
				__result = __instance.GetHandPresenceInputForHand(realHandId);
				return false;
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(BootloaderBridgeSystem), "GetHandPresenceInputForHand", new Type[] { typeof(Hand) })]
	public static class LoaderHandPresenceCopy
	{
		private static bool Prefix(Hand hand, ref BootloaderBridgeSystem __instance, ref HandPresenceInput __result)
		{
			//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_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_0033: Unknown result type (might be due to invalid IL or missing references)
			if (tracklessMode)
			{
				return false;
			}
			if (oneHandedMode && virtualHandId == hand)
			{
				__result = __instance.GetHandPresenceInputForHand(realHandId);
				return false;
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(PlayerController), "Initialize", new Type[] { typeof(Player) })]
	public static class playerspawn
	{
		private static void Postfix(ref PlayerController __instance, ref Player player)
		{
			if (Players.GetLocalPlayer() == player)
			{
				needInit = true;
			}
		}
	}

	[HarmonyPatch(typeof(BootLoaderMeasurementSystem), "OnMeasurementFailed", new Type[] { })]
	public static class CheckOnMeasurementFailed
	{
		private static bool Prefix(ref BootLoaderMeasurementSystem __instance)
		{
			if (oneHandedMode && Utils.SetMeasurement())
			{
				AudioSource onMeasureSFX = __instance.onMeasureSFX;
				onMeasureSFX.Play();
				MelonCoroutines.Start(LoadGym());
				return false;
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(PlayerScaling), "OnMeasureTimerEnd", new Type[] { })]
	public static class CheckOnMeasureTimerEnd
	{
		private static bool Prefix(ref PlayerScaling __instance)
		{
			if (oneHandedMode)
			{
				__instance.onMeasureFailedAudioCall = __instance.onMeasureAudioCall;
				return true;
			}
			return true;
		}

		private static void Postfix(ref PlayerScaling __instance)
		{
			if (oneHandedMode)
			{
				Utils.SetMeasurement();
			}
		}
	}

	[HarmonyPatch(typeof(InteractionHapticsSignal), "Apply", new Type[] { })]
	public static class StopApplyInteraction
	{
		private static bool Prefix(ref InteractionHapticsSignal __instance)
		{
			//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 (oneHandedMode && !keepHaptics && __instance.targetHand.handType == virtualHandId)
			{
				return false;
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(PlayerHaptics), "AddHapticsSignal", new Type[]
	{
		typeof(float),
		typeof(float),
		typeof(float)
	})]
	public static class StopAddHapticsSignal
	{
		private static bool Prefix(ref PlayerHaptics __instance, ref float leftIntensity, ref float rightIntensity, float screenShakeIntensity)
		{
			if (oneHandedMode && !keepHaptics)
			{
				if (!status[0])
				{
					leftIntensity = 0f;
				}
				if (!status[1])
				{
					rightIntensity = 0f;
				}
			}
			return true;
		}
	}

	private Mod Mod = new Mod();

	private static bool needInit = false;

	private static bool initialized = false;

	private static bool modInitialized = false;

	private static bool oneHandedMode = false;

	private static bool tracklessMode = false;

	private static bool keepHaptics = false;

	public static bool[] status = new bool[2] { true, true };

	private bool useMute = false;

	private bool useTurn = false;

	private int i_real = 0;

	private int i_virtual = 1;

	private int i_talk = 1;

	private int i_walk = 0;

	private int i_measure1 = 0;

	private int i_measure2 = 1;

	private static GameObject realHand;

	private static GameObject virtualHand;

	private static Hand virtualHandId;

	private static Hand realHandId;

	private static bool isLoader;

	private static bool isGym;

	private TextMeshProUGUI instructions;

	private TextMeshProUGUI rightButtonText;

	private TextMeshProUGUI leftButtonText;

	private GameObject rightHandText;

	private GameObject leftHandText;

	private string leftButtonName;

	private string rightButtonName;

	private readonly Hand LEFT_HAND = (Hand)1;

	private readonly Hand RIGHT_HAND = (Hand)2;

	private readonly string[] side = new string[2] { "left", "right" };

	public static void Log(string msg)
	{
		MelonLogger.Msg(msg);
	}

	public override void OnLateInitializeMelon()
	{
		UI.instance.UI_Initialized += OnUIInit;
	}

	public void SetUIOptions()
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Expected O, but got Unknown
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Expected O, but got Unknown
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Expected O, but got Unknown
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Expected O, but got Unknown
		Mod.ModName = "OneHandedRumble";
		Mod.ModVersion = "1.0.0";
		Mod.SetFolder("OneHandedRumble");
		Mod.AddToList("Left enabled", true, 0, "Enable tracking for the left controller.", new Tags());
		Mod.AddToList("Right enabled", true, 0, "Enable tracking for the right controller.", new Tags());
		Mod.AddToList("Use Mute on enabled controller", false, 0, "The default action for the primary button is push-to-talk, enable this to switch it with mute.The other action is still available on the disabled controller.\n\nThis option does nothing when both controllers are enabled.", new Tags());
		Mod.AddToList("Use Turn on enabled controller", false, 0, "The default action for the joystick is walk, enable this to switch it with turn.The other action is still available on the disabled controller.\n\nThis option does nothing when both controllers are enabled.", new Tags());
		Mod.AddToList("Keep haptics", false, 0, "Enable haptics on the disabled controller.\n\nSet to false if you keep the disabled controller in hand and want it to get all haptic signals.", new Tags());
		Mod.GetFromFile();
	}

	public void OnUIInit()
	{
		Mod.ModSaved += OnUISaved;
		UI.instance.AddMod(Mod);
	}

	public void OnUISaved()
	{
		UpdateMode();
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		Log("Detected scene '" + sceneName + "'");
		isGym = sceneName == "Gym";
		isLoader = sceneName == "Loader";
		if (isLoader)
		{
			SetUIOptions();
			InitScene();
		}
	}

	public void InitScene()
	{
		Utils.Initialize(isLoader);
		if (isLoader)
		{
			Transform transform = GameObject.Find("________________SCENE_________________/Text/Measuring/TextCanvas").transform;
			instructions = ((Component)transform.GetChild(0)).GetComponent<TextMeshProUGUI>();
			rightButtonText = ((Component)transform.GetChild(2)).GetComponent<TextMeshProUGUI>();
			leftButtonText = ((Component)transform.GetChild(3)).GetComponent<TextMeshProUGUI>();
			rightHandText = ((Component)transform.GetChild(4)).gameObject;
			leftHandText = ((Component)transform.GetChild(5)).gameObject;
		}
		else if (isGym)
		{
			instructions = GameObject.Find("------------TUTORIAL------------/Static tutorials/Measure/Stone rumble man (1)/Text/MeasureTextCanvas/MesureText").GetComponent<TextMeshProUGUI>();
		}
		UpdateMode();
		if (isLoader)
		{
			modInitialized = true;
		}
		initialized = true;
		Log("Initialized controls");
	}

	private void UpdateMode()
	{
		bool[] array = new bool[2] { true, true };
		bool flag = Matchmaking.getMatchmakingTypeAsInt() >= 0;
		if (!flag)
		{
			array[0] = (bool)Mod.Settings[0].SavedValue;
			array[1] = (bool)Mod.Settings[1].SavedValue;
		}
		useMute = (bool)Mod.Settings[2].SavedValue;
		useTurn = (bool)Mod.Settings[3].SavedValue;
		keepHaptics = (bool)Mod.Settings[4].SavedValue;
		bool flag2 = !modInitialized || array[0] != status[0] || array[1] != status[1];
		SetControllerStatus(isLeft: true, array[0]);
		SetControllerStatus(isLeft: false, array[1]);
		if (flag2)
		{
			if (flag)
			{
				Log("Mod disabled because a match has been started");
			}
			string text = "";
			text = ((!oneHandedMode) ? (status[0] ? "Entering normal two-handed mode" : "Disabling tracking for both hands (why?)") : ("Entering " + side[i_real] + "-handed mode"));
			Log(text);
		}
		SetMeasureBindings();
		SetJoystickBindings();
		SetPushToTalkBindings();
		if (isLoader || isGym)
		{
			UpdateMeasurementInstructions();
		}
	}

	private void UpdateMeasurementInstructions()
	{
		string text;
		if (!isLoader)
		{
			text = (oneHandedMode ? ("Assume this pose then\nPress and HOLD the " + (status[0] ? leftButtonName : rightButtonName) + " to MEASURE") : ((!tracklessMode) ? ("Assume this pose then\nPress and HOLD the " + leftButtonName + " and " + rightButtonName + " to MEASURE") : "Assume this pose then\nTHINK whether disabling BOTH controllers was a good idea"));
		}
		else
		{
			leftHandText.active = status[0];
			rightHandText.active = status[1];
			if (oneHandedMode)
			{
				text = "Assume this POSE, and HOLD this button for TWO SECONDS";
			}
			else if (tracklessMode)
			{
				text = "Assume this POSE, and THINK for TWO\u00a0SECONDS whether disabling BOTH controllers was a good idea";
				TextMeshProUGUI obj = instructions;
				((TMP_Text)obj).m_fontSize = ((TMP_Text)obj).m_fontSize * 0.8f;
			}
			else
			{
				text = "Assume this POSE, and HOLD these buttons for TWO SECONDS";
			}
		}
		((TMP_Text)instructions).SetText(text, true);
	}

	private void SetControllerStatus(bool isLeft, bool enabled)
	{
		//IL_009d: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		int num = ((!isLeft) ? 1 : 0);
		bool flag = enabled != status[num];
		status[num] = enabled;
		oneHandedMode = status[0] != status[1];
		tracklessMode = !oneHandedMode && !enabled;
		if (oneHandedMode)
		{
			realHand = (status[0] ? Utils.leftHand : Utils.rightHand);
			virtualHand = (status[0] ? Utils.rightHand : Utils.leftHand);
			realHandId = (status[0] ? LEFT_HAND : RIGHT_HAND);
			virtualHandId = (status[0] ? RIGHT_HAND : LEFT_HAND);
			i_real = ((!status[0]) ? 1 : 0);
			i_virtual = 1 - i_real;
		}
	}

	public override void OnFixedUpdate()
	{
		if (needInit)
		{
			isLoader = false;
			InitScene();
			needInit = false;
		}
		try
		{
			if (initialized)
			{
				((Behaviour)Utils.leftHand.GetComponent<TrackedPoseDriver>()).enabled = status[0];
				((Behaviour)Utils.rightHand.GetComponent<TrackedPoseDriver>()).enabled = status[1];
				if (isLoader)
				{
					leftButtonName = ((TMP_Text)leftButtonText).m_text;
					rightButtonName = ((TMP_Text)rightButtonText).m_text;
					((Component)leftButtonText).gameObject.active = status[0];
					((Component)rightButtonText).gameObject.active = status[1];
				}
			}
		}
		catch (Exception)
		{
			initialized = false;
		}
	}

	public override void OnUpdate()
	{
		try
		{
			if (initialized && oneHandedMode)
			{
				if ((double)LeftController.GetTrigger() > 0.3 || (double)RightController.GetTrigger() > 0.3)
				{
					Utils.FreezeObject(virtualHand);
				}
				else
				{
					Utils.MirrorObject(realHand, virtualHand);
				}
			}
		}
		catch (Exception)
		{
			initialized = false;
		}
	}

	public void SetMeasureBindings()
	{
		int num = i_measure1;
		int num2 = i_measure2;
		i_measure1 = (oneHandedMode ? i_real : 0);
		i_measure2 = ((!oneHandedMode) ? 1 : i_real);
		if (!modInitialized || i_measure1 != num || i_measure2 != num2)
		{
			Utils.ReplaceBindings(Utils.leftMeasureAction, Utils.measureButtons[i_measure1]);
			Utils.ReplaceBindings(Utils.rightMeasureAction, Utils.measureButtons[i_measure2]);
			if (oneHandedMode)
			{
				Log("T-pose measure with the " + side[i_real] + " controller");
			}
			else
			{
				Log("T-pose measure with both controllers");
			}
		}
	}

	public void SetJoystickBindings()
	{
		int num = i_walk;
		i_walk = (oneHandedMode ? (useTurn ? i_virtual : i_real) : 0);
		if (!modInitialized || i_walk != num)
		{
			Utils.ReplaceBindings(Utils.walkAction, Utils.joysticks[i_walk]);
			Utils.ReplaceBindings(Utils.turnAction, Utils.joysticks[1 - i_walk]);
			Log("Walk with the " + side[i_walk] + " controller");
			Log("Turn with the " + side[1 - i_walk] + " controller");
		}
	}

	public void SetPushToTalkBindings()
	{
		int num = i_talk;
		i_talk = ((!oneHandedMode) ? 1 : (useMute ? i_virtual : i_real));
		if (!modInitialized || i_talk != num)
		{
			Utils.ReplaceBindings(Utils.talkAction, Utils.pushToTalkButtons[i_talk]);
			Utils.ReplaceBindings(Utils.muteAction, Utils.pushToTalkButtons[1 - i_talk]);
			Log("Push To Talk with the " + side[i_talk] + " controller");
			Log("Mute with the " + side[1 - i_talk] + " controller");
		}
	}

	private static IEnumerator LoadGym()
	{
		yield return (object)new WaitForSeconds(0.5f);
		Singleton<SceneManager>.instance.PerformStartupGymLoad();
	}
}
public class Utils
{
	private static bool initialized = false;

	private static Transform headset = null;

	private static Transform chest = null;

	private static Transform root = null;

	public static GameObject leftHand = null;

	public static GameObject rightHand = null;

	public static InputAction leftMeasureAction = null;

	public static InputAction rightMeasureAction = null;

	public static InputAction muteAction = null;

	public static InputAction talkAction = null;

	public static InputAction walkAction = null;

	public static InputAction turnAction = null;

	public static List<ReadOnlyArray<InputBinding>> measureButtons = null;

	public static List<ReadOnlyArray<InputBinding>> pushToTalkButtons = null;

	public static List<ReadOnlyArray<InputBinding>> joysticks = null;

	public static Exception uninitException = new Exception("You must first call Utils.Initialize before calling the methods");

	private static Vector3 localPosition;

	private static Quaternion localRotation;

	public static void Log(string msg)
	{
		MelonLogger.Msg(msg);
	}

	private static void UpdateChestTransform()
	{
		//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_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_003b: 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)
		Vector3 val = headset.localPosition;
		Quaternion val2 = headset.localRotation;
		float y = ((Quaternion)(ref val2)).eulerAngles.y;
		Vector3 val3 = default(Vector3);
		((Vector3)(ref val3))..ctor(0f, y, 0f);
		chest.SetLocalPositionAndRotation(val, Quaternion.Euler(val3));
	}

	public static void Initialize(bool isLoader)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: 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_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		root = new GameObject("Root").transform;
		if (isLoader)
		{
			Transform transform = GameObject.Find("BootLoaderPlayer").transform;
			headset = transform.GetChild(1).GetChild(0);
			leftHand = ((Component)transform.GetChild(2)).gameObject;
			rightHand = ((Component)transform.GetChild(3)).gameObject;
			root.SetParent(transform);
			root.SetLocalPositionAndRotation(new Vector3(0f, 0.1f, 0f), Quaternion.identity);
		}
		else
		{
			Transform child = ((Component)Players.GetPlayerController()).gameObject.transform.GetChild(1);
			headset = child.GetChild(0).GetChild(0);
			leftHand = ((Component)child.GetChild(1)).gameObject;
			rightHand = ((Component)child.GetChild(2)).gameObject;
			root.SetParent(child.GetChild(3));
			root.SetLocalPositionAndRotation(new Vector3(0f, -0.045f, 0f), Quaternion.identity);
		}
		chest = new GameObject("Chest").transform;
		chest.SetParent(headset.parent);
		if (!initialized)
		{
			InputManager instance = Singleton<InputManager>.instance;
			leftMeasureAction = GetAction(instance, isLeft: true, "Measure");
			rightMeasureAction = GetAction(instance, isLeft: false, "Measure");
			muteAction = GetAction(instance, isLeft: true, "Mute");
			talkAction = GetAction(instance, isLeft: false, "PushToTalk");
			walkAction = GetAction(instance, isLeft: true, "Walk");
			turnAction = GetAction(instance, isLeft: false, "Turn");
			measureButtons = new List<ReadOnlyArray<InputBinding>>
			{
				ReadOnlyArray<InputBinding>.op_Implicit(leftMeasureAction.bindings.ToArray()),
				ReadOnlyArray<InputBinding>.op_Implicit(rightMeasureAction.bindings.ToArray())
			};
			pushToTalkButtons = new List<ReadOnlyArray<InputBinding>>
			{
				ReadOnlyArray<InputBinding>.op_Implicit(muteAction.bindings.ToArray()),
				ReadOnlyArray<InputBinding>.op_Implicit(talkAction.bindings.ToArray())
			};
			joysticks = new List<ReadOnlyArray<InputBinding>>
			{
				ReadOnlyArray<InputBinding>.op_Implicit(walkAction.bindings.ToArray()),
				ReadOnlyArray<InputBinding>.op_Implicit(turnAction.bindings.ToArray())
			};
			initialized = true;
		}
	}

	public static void MirrorObject(GameObject obj1, GameObject obj2)
	{
		//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_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		if (!initialized)
		{
			throw uninitException;
		}
		UpdateChestTransform();
		obj2.transform.position = MirrorPosition(obj1.transform.position);
		obj2.transform.rotation = MirrorRotation(obj1.transform.rotation);
	}

	public static void FreezeObject(GameObject obj)
	{
		//IL_0020: 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)
		if (!initialized)
		{
			throw uninitException;
		}
		UpdateChestTransform();
		obj.transform.position = GetGlobalPosition();
		obj.transform.rotation = GetGlobalRotation();
	}

	public static Vector3 MirrorPosition(Vector3 objPos)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: 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_0041: Unknown result type (might be due to invalid IL or missing references)
		if (!initialized)
		{
			throw uninitException;
		}
		localPosition = chest.InverseTransformPoint(objPos);
		localPosition.x = 0f - localPosition.x;
		return GetGlobalPosition();
	}

	public static Quaternion MirrorRotation(Quaternion objRot)
	{
		//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_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_0058: 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_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_006a: Unknown result type (might be due to invalid IL or missing references)
		if (!initialized)
		{
			throw uninitException;
		}
		localRotation = Quaternion.Inverse(chest.rotation) * objRot;
		localRotation = new Quaternion(localRotation.x, 0f - localRotation.y, 0f - localRotation.z, localRotation.w);
		return GetGlobalRotation();
	}

	public static Vector3 GetGlobalPosition()
	{
		//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_0026: Unknown result type (might be due to invalid IL or missing references)
		if (!initialized)
		{
			throw uninitException;
		}
		return chest.TransformPoint(localPosition);
	}

	public static Quaternion GetGlobalRotation()
	{
		//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)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		if (!initialized)
		{
			throw uninitException;
		}
		return chest.rotation * localRotation;
	}

	public static InputAction GetAction(InputManager inputManager, bool isLeft, string name)
	{
		//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)
		Hand val = (Hand)(isLeft ? 1 : 2);
		InputActionMap actionMap = inputManager.GetActionMap(val);
		Enumerator<InputAction> enumerator = actionMap.actions.GetEnumerator();
		while (enumerator.MoveNext())
		{
			InputAction current = enumerator.Current;
			if (name == current.name)
			{
				return current;
			}
		}
		return null;
	}

	public static void ReplaceBindings(InputAction action, ReadOnlyArray<InputBinding> newBindings)
	{
		int length = action.bindings.m_Length;
		for (int i = 0; i < length; i++)
		{
			InputActionSetupExtensions.ChangeBinding(action, 0).Erase();
		}
		Enumerator<InputBinding> enumerator = newBindings.GetEnumerator();
		while (enumerator.MoveNext())
		{
			InputBinding current = enumerator.Current;
			InputActionSetupExtensions.AddBinding(action, current.path, current.interactions, current.processors, current.groups);
		}
	}

	public static bool SetMeasurement()
	{
		//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_004b: Unknown result type (might be due to invalid IL or missing references)
		UpdateChestTransform();
		PlayerManager instance = Singleton<PlayerManager>.instance;
		PlayerMeasurement val = PlayerMeasurement.Create(headset, leftHand.transform, rightHand.transform, root, true);
		if (instance.localPlayer != null)
		{
			instance.localPlayer.Data.SetMeasurement(val, true);
			return true;
		}
		return false;
	}
}