Decompiled source of SuperFlat v1.0.2

SuperHotVRFlatscreenTurt.dll

Decompiled 21 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using HarmonyLib;
using Il2Cpp;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using MelonLoader;
using MelonLoader.Preferences;
using SuperFlat;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(mainclass), "SuperFlat", "1.0.0", "BayTurtleKing", null)]
[assembly: MelonGame(null, null)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace SuperFlat;

public class mainclass : MelonMod
{
	private static float nexttimeidk;

	private static float yawww;

	private static float pitchhh;

	private static bool gotyawww;

	private static float heighttt = 1.7f;

	private static float punchleftat = -10f;

	private static float punchrightat = -10f;

	private static Quaternion lastheadrott = Quaternion.identity;

	private static float launchseenatidk;

	private static int stagee;

	private static string lastscenee = "";

	private static float sceneseenatt;

	private static bool fixeddd;

	private static float throwleftat = -10f;

	private static float throwrightat = -10f;

	private static readonly float throwwindupp = 0.12f;

	private static readonly float throwreleaseat = 0.24f;

	private static readonly float throwvelendd = 0.32f;

	private static readonly float throwtotall = 0.5f;

	private static bool[] throwheldd = new bool[2];

	private static int[] throwupframee = new int[2] { -10, -10 };

	private static bool[] gripholdd = new bool[2];

	private static int[] griponframee = new int[2] { -10, -10 };

	private static int[] gripoffframee = new int[2] { -10, -10 };

	private static MelonPreferences_Category catt;

	private static MelonPreferences_Entry<string> daconfiforwardd;

	private static MelonPreferences_Entry<string> daconfibackk;

	private static MelonPreferences_Entry<string> daconfileftt;

	private static MelonPreferences_Entry<string> daconfirightt;

	private static MelonPreferences_Entry<string> daconficrouchh;

	private static MelonPreferences_Entry<string> daconfilocktogglee;

	private static MelonPreferences_Entry<bool> daconfilockstartt;

	private static bool mouselockedd;

	private static bool wasfocusedd = true;

	private static int relockk;

	private static MelonPreferences_Entry<string> daconfitriggerr;

	private static MelonPreferences_Entry<string> daconfitriggerleftt;

	private static MelonPreferences_Entry<string> daconfigripleftt;

	private static MelonPreferences_Entry<string> daconfigriprightt;

	private static MelonPreferences_Entry<string> daconfipunchleftt;

	private static MelonPreferences_Entry<string> daconfipunchrightt;

	private static MelonPreferences_Entry<string> daconfithrowleftt;

	private static MelonPreferences_Entry<string> daconfithrowrightt;

	private static MelonPreferences_Entry<string> daconfiputonn;

	private static float putonuntill;

	private static MelonPreferences_Entry<float> daconfispeedd;

	private static MelonPreferences_Entry<float> daconfisensss;

	private static MelonPreferences_Entry<float> daconfithrowspeedd;

	private static MelonPreferences_Entry<float> daconfihandstartt;

	private static MelonPreferences_Entry<float> daconfihandstepp;

	private static MelonPreferences_Entry<float> daconfihandminn;

	private static MelonPreferences_Entry<float> daconfihandmaxx;

	private static float handdistt = 0.45f;

	private static readonly Dictionary<string, ButtonControl> bindcachee = new Dictionary<string, ButtonControl>();

	public override void OnInitializeMelon()
	{
		catt = MelonPreferences.CreateCategory("SuperFlat");
		daconfiforwardd = catt.CreateEntry<string>("go_forward", "W", (string)null, "key to move forward", false, false, (ValueValidator)null, (string)null);
		daconfibackk = catt.CreateEntry<string>("go_back", "S", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		daconfileftt = catt.CreateEntry<string>("go_left", "A", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		daconfirightt = catt.CreateEntry<string>("go_right", "D", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		daconfispeedd = catt.CreateEntry<float>("go_speed", 2.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		daconficrouchh = catt.CreateEntry<string>("crouch", "LeftCtrl", (string)null, "key to crouch", false, false, (ValueValidator)null, (string)null);
		daconfilocktogglee = catt.CreateEntry<string>("mouse_lock_toggle", "LeftShift", (string)null, "mouse lock keybind. when on, the mouse is locked and when off you use right click to rotate.", false, false, (ValueValidator)null, (string)null);
		daconfilockstartt = catt.CreateEntry<bool>("is_mouse_lock", true, (string)null, "mouse is locked on start", false, false, (ValueValidator)null, (string)null);
		daconfitriggerr = catt.CreateEntry<string>("theright_trigger", "Mouse1", (string)null, "shoot or use whatever is in your right hand, punches if your right hand is empty and mouse is locked", false, false, (ValueValidator)null, (string)null);
		daconfitriggerleftt = catt.CreateEntry<string>("theleft_trigger", "Mouse0", (string)null, "shoot or use whatever is in your left hand, punches if your left hand is empty and mouse is locked", false, false, (ValueValidator)null, (string)null);
		daconfigripleftt = catt.CreateEntry<string>("hold_left", "Q", (string)null, "press once to pick up the item in your left hand, press again to let go", false, false, (ValueValidator)null, (string)null);
		daconfigriprightt = catt.CreateEntry<string>("hold_right", "E", (string)null, "press once to pick up the item in your right hand, press again to let go", false, false, (ValueValidator)null, (string)null);
		daconfipunchleftt = catt.CreateEntry<string>("punch_left", "Z", (string)null, "keybind to punch in left hand", false, false, (ValueValidator)null, (string)null);
		daconfipunchrightt = catt.CreateEntry<string>("punch_right", "X", (string)null, "keybind to punch in right hand", false, false, (ValueValidator)null, (string)null);
		daconfithrowleftt = catt.CreateEntry<string>("throw_left", "C", (string)null, "while holding something in left hand press this to throw it", false, false, (ValueValidator)null, (string)null);
		daconfithrowrightt = catt.CreateEntry<string>("throw_right", "V", (string)null, "while holding something in right hand press this to throw it", false, false, (ValueValidator)null, (string)null);
		daconfiputonn = catt.CreateEntry<string>("put_on_headset", "H", (string)null, "intro room helper: lets go of the headset and holds it on your head for a moment so the game counts it as put on", false, false, (ValueValidator)null, (string)null);
		daconfisensss = catt.CreateEntry<float>("sensetitivy_look", 0.1f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		daconfithrowspeedd = catt.CreateEntry<float>("how_strong_throw", 6f, (string)null, "how fast thrown objects go in meters a second", false, false, (ValueValidator)null, (string)null);
		daconfihandstartt = catt.CreateEntry<float>("where_hands_start", 0.45f, (string)null, "how far in front of you your hands start, scroll wheel changes it while the mouse is locked", false, false, (ValueValidator)null, (string)null);
		daconfihandstepp = catt.CreateEntry<float>("hands_per_scrolll", 0.05f, (string)null, "how much your hands move when you scroll", false, false, (ValueValidator)null, (string)null);
		daconfihandminn = catt.CreateEntry<float>("hands_closest", 0.01f, (string)null, "the minimum distance your hands can be", false, false, (ValueValidator)null, (string)null);
		daconfihandmaxx = catt.CreateEntry<float>("hands_farthest", 1.2f, (string)null, "the maximu distance your hands can be", false, false, (ValueValidator)null, (string)null);
		handdistt = daconfihandstartt.Value;
		mouselockedd = daconfilockstartt.Value;
		catt.SaveToFile(false);
	}

	public override void OnPreferencesLoaded()
	{
		bindcachee.Clear();
	}

	private static ButtonControl getbindd(string namee)
	{
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		if (string.IsNullOrEmpty(namee))
		{
			return null;
		}
		if (bindcachee.TryGetValue(namee, out var value))
		{
			return value;
		}
		ButtonControl val = null;
		try
		{
			if (namee.StartsWith("Mouse"))
			{
				Mouse current = Mouse.current;
				if (current == null)
				{
					return null;
				}
				switch (namee)
				{
				case "Mouse0":
					val = current.leftButton;
					break;
				case "Mouse1":
					val = current.rightButton;
					break;
				case "Mouse2":
					val = current.middleButton;
					break;
				case "Mouse3":
					val = current.backButton;
					break;
				case "Mouse4":
					val = current.forwardButton;
					break;
				}
			}
			else
			{
				Keyboard current2 = Keyboard.current;
				if (current2 == null)
				{
					return null;
				}
				if (namee != "None" && Enum.TryParse<Key>(namee, ignoreCase: true, out Key result) && (int)result != 0)
				{
					val = (ButtonControl)(object)current2[result];
				}
			}
		}
		catch (Exception)
		{
		}
		bindcachee[namee] = val;
		return val;
	}

	private static bool heldd(MelonPreferences_Entry<string> entryy)
	{
		ButtonControl val = getbindd(entryy.Value);
		if (val != null)
		{
			return val.isPressed;
		}
		return false;
	}

	private static bool downn(MelonPreferences_Entry<string> entryy)
	{
		ButtonControl val = getbindd(entryy.Value);
		if (val != null)
		{
			return val.wasPressedThisFrame;
		}
		return false;
	}

	private static bool upp(MelonPreferences_Entry<string> entryy)
	{
		ButtonControl val = getbindd(entryy.Value);
		if (val != null)
		{
			return val.wasReleasedThisFrame;
		}
		return false;
	}

	private static bool bindmodee(MelonPreferences_Entry<string> entryy, int modee)
	{
		return modee switch
		{
			1 => downn(entryy), 
			0 => heldd(entryy), 
			_ => upp(entryy), 
		};
	}

	public override void OnLateUpdate()
	{
		handsinfront();
	}

	public override void OnUpdate()
	{
		if (downn(daconfiputonn))
		{
			startputonn();
		}
		tickputonn();
		fixthescreenthatloads();
		thisgameshowisrigged();
		makeheadsetfakee();
		mouselocktickk();
		scrollhandss();
		itstimeforwasd();
		punchkeysss();
		gripticc();
		throwtickk();
		handsinfront();
	}

	private static void fixthescreenthatloads()
	{
		VRLaunch i = VRLaunch._i;
		if ((Object)(object)i == (Object)null)
		{
			launchseenatidk = 0f;
			stagee = 0;
			return;
		}
		if (launchseenatidk == 0f)
		{
			launchseenatidk = Time.unscaledTime;
		}
		float num = Time.unscaledTime - launchseenatidk;
		if (num > 6f && stagee == 0)
		{
			stagee = 1;
			try
			{
				if (i.asyncLoad == null)
				{
					VRLaunch.LoadSavedLevel();
				}
				i.OnLoadCompleted();
			}
			catch (Exception)
			{
			}
		}
		if (!(num > 8f) || stagee != 1)
		{
			return;
		}
		stagee = 2;
		try
		{
			if (i.asyncLoad != null)
			{
				i.asyncLoad.AllowSceneActivation();
			}
		}
		catch (Exception)
		{
		}
	}

	private static void thisgameshowisrigged()
	{
		//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_00dd: Unknown result type (might be due to invalid IL or missing references)
		Scene activeScene = SceneManager.GetActiveScene();
		string name = ((Scene)(ref activeScene)).name;
		if (name != lastscenee)
		{
			lastscenee = name;
			sceneseenatt = Time.unscaledTime;
			fixeddd = false;
		}
		if (UnityXRManager.CurrentInputSubsystem != null || name == "VRLaunch")
		{
			return;
		}
		CameraRig instance = MonoBehaviourSingleton<CameraRig>.Instance;
		if ((Object)(object)instance == (Object)null)
		{
			return;
		}
		if (!fixeddd && Time.unscaledTime - sceneseenatt > 2f)
		{
			fixeddd = true;
			try
			{
				instance.AutoPosition();
				instance.AutoRotate();
			}
			catch (Exception)
			{
			}
		}
		if ((Object)(object)instance.UnityXRHmdTransform != (Object)null)
		{
			float num = (heldd(daconficrouchh) ? 0.8f : 1.7f);
			heighttt = Mathf.MoveTowards(heighttt, num, 4f * Time.unscaledDeltaTime);
			instance.UnityXRHmdTransform.localPosition = new Vector3(0f, heighttt, 0f);
		}
	}

	private static void puttt(Transform tt, Vector3 pos, Quaternion rot)
	{
		//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)
		if ((Object)(object)tt != (Object)null)
		{
			tt.position = pos;
			tt.rotation = rot;
		}
	}

	private static float punchamountt(float startt)
	{
		float num = Time.unscaledTime - startt - 0.1f;
		if (num < 0f || num > 0.28f)
		{
			return 0f;
		}
		if (!(num < 0.08f))
		{
			return 1f - (num - 0.08f) / 0.2f;
		}
		return num / 0.08f;
	}

	private static void mouselocktickk()
	{
		if (UnityXRManager.CurrentInputSubsystem != null)
		{
			return;
		}
		if (downn(daconfilocktogglee))
		{
			mouselockedd = !mouselockedd;
		}
		if (!Application.isFocused)
		{
			wasfocusedd = false;
			return;
		}
		if (!wasfocusedd)
		{
			wasfocusedd = true;
			relockk = 2;
			bindcachee.Clear();
		}
		if (relockk > 0)
		{
			relockk--;
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
		}
		else
		{
			Cursor.lockState = (CursorLockMode)(mouselockedd ? 1 : 0);
			Cursor.visible = !mouselockedd;
		}
	}

	private static void scrollhandss()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		if (UnityXRManager.CurrentInputSubsystem != null || !mouselockedd || !Application.isFocused)
		{
			return;
		}
		Mouse current = Mouse.current;
		if (current != null)
		{
			float y = ((InputControl<Vector2>)(object)current.scroll).ReadValue().y;
			if (y != 0f)
			{
				handdistt = Mathf.Clamp(handdistt + Mathf.Sign(y) * daconfihandstepp.Value, daconfihandminn.Value, daconfihandmaxx.Value);
			}
		}
	}

	private static void punchkeysss()
	{
		if (downn(daconfipunchleftt))
		{
			punchleftat = Time.unscaledTime;
		}
		if (downn(daconfipunchrightt))
		{
			punchrightat = Time.unscaledTime;
		}
		if (mouselockedd)
		{
			if (daconfitriggerr.Value == daconfitriggerleftt.Value)
			{
				if (downn(daconfitriggerr) && !gripholdd[0] && !gripholdd[1])
				{
					punchrightat = Time.unscaledTime;
				}
			}
			else
			{
				if (downn(daconfitriggerleftt) && !gripholdd[0])
				{
					punchleftat = Time.unscaledTime;
				}
				if (downn(daconfitriggerr) && !gripholdd[1])
				{
					punchrightat = Time.unscaledTime;
				}
			}
		}
		if (downn(daconfithrowleftt) && Time.unscaledTime - throwleftat > throwtotall)
		{
			throwleftat = Time.unscaledTime;
		}
		if (downn(daconfithrowrightt) && Time.unscaledTime - throwrightat > throwtotall)
		{
			throwrightat = Time.unscaledTime;
		}
	}

	private static void gripticc()
	{
		for (int i = 0; i < 2; i++)
		{
			float num = Time.unscaledTime - ((i == 0) ? throwleftat : throwrightat);
			if ((!(num >= 0f) || !(num < throwtotall)) && downn((i == 0) ? daconfigripleftt : daconfigriprightt))
			{
				gripholdd[i] = !gripholdd[i];
				if (gripholdd[i])
				{
					griponframee[i] = Time.frameCount;
				}
				else
				{
					gripoffframee[i] = Time.frameCount;
				}
			}
		}
	}

	private static void throwtickk()
	{
		for (int i = 0; i < 2; i++)
		{
			float num = Time.unscaledTime - ((i == 0) ? throwleftat : throwrightat);
			bool flag = num >= 0f && num < throwtotall;
			bool flag2 = flag && num < throwreleaseat;
			if (throwheldd[i] && !flag2 && flag)
			{
				throwupframee[i] = Time.frameCount;
				gripholdd[i] = false;
			}
			throwheldd[i] = flag2;
		}
	}

	private static Vector3 throwoffsett(float startt)
	{
		//IL_0018: 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_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		float num = Time.unscaledTime - startt;
		if (num < 0f || num >= throwtotall)
		{
			return Vector3.zero;
		}
		Vector3 val = default(Vector3);
		((Vector3)(ref val))..ctor(0f, 0.25f, -0.25f);
		Vector3 val2 = default(Vector3);
		((Vector3)(ref val2))..ctor(0f, 0.1f, 0.55f);
		if (num < throwwindupp)
		{
			return Vector3.Lerp(Vector3.zero, val, num / throwwindupp);
		}
		if (num < 0.3f)
		{
			return Vector3.Lerp(val, val2, (num - throwwindupp) / (0.3f - throwwindupp));
		}
		return Vector3.Lerp(val2, Vector3.zero, (num - 0.3f) / (throwtotall - 0.3f));
	}

	private static Vector3 throwvelocityy(float startt)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: 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_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_0041: 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_0053: Unknown result type (might be due to invalid IL or missing references)
		float num = Time.unscaledTime - startt;
		if (num < throwwindupp || num > throwvelendd)
		{
			return Vector3.zero;
		}
		Vector3 val = lastheadrott * Vector3.forward + Vector3.up * 0.35f;
		return ((Vector3)(ref val)).normalized * daconfithrowspeedd.Value;
	}

	private static bool gripsidee(int ii, int modee)
	{
		float num = Time.unscaledTime - ((ii == 0) ? throwleftat : throwrightat);
		bool flag = num >= 0f && num < throwtotall;
		if (modee == 2 && Time.frameCount - throwupframee[ii] <= 1)
		{
			return true;
		}
		if (flag)
		{
			if (modee == 0)
			{
				return num < throwreleaseat;
			}
			return false;
		}
		return modee switch
		{
			0 => gripholdd[ii], 
			1 => Time.frameCount - griponframee[ii] <= 1, 
			_ => Time.frameCount - gripoffframee[ii] <= 1, 
		};
	}

	private static Collider findcolll(string namee, Vector3 centerr)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		foreach (Collider item in (Il2CppArrayBase<Collider>)(object)Physics.OverlapSphere(centerr, 6f, -1, (QueryTriggerInteraction)2))
		{
			if (((Object)((Component)item).gameObject).name == namee)
			{
				return item;
			}
		}
		return null;
	}

	private static void startputonn()
	{
		for (int i = 0; i < 2; i++)
		{
			if (gripholdd[i])
			{
				gripholdd[i] = false;
				gripoffframee[i] = Time.frameCount;
			}
		}
		putonuntill = Time.unscaledTime + 1.5f;
		MelonLogger.Msg("put_on_headset: releasing and holding the headset on your head");
	}

	private static void tickputonn()
	{
		//IL_0040: 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_00aa: 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_00b5: 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_00be: 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_00e2: 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)
		if (Time.unscaledTime >= putonuntill)
		{
			return;
		}
		CameraRig instance = MonoBehaviourSingleton<CameraRig>.Instance;
		if ((Object)(object)instance == (Object)null)
		{
			return;
		}
		Transform val = (((Object)(object)instance.UnityXRHmdTransform != (Object)null) ? instance.UnityXRHmdTransform : ((Component)instance).transform);
		Collider val2 = findcolll("VRHeadset", val.position);
		if ((Object)(object)val2 == (Object)null)
		{
			return;
		}
		VRHeadset component = ((Component)val2).GetComponent<VRHeadset>();
		if ((Object)(object)component != (Object)null && component.HasBeenPutOn)
		{
			putonuntill = 0f;
			MelonLogger.Msg("put_on_headset: headset is on");
			return;
		}
		Rigidbody attachedRigidbody = val2.attachedRigidbody;
		Transform obj = (((Object)(object)attachedRigidbody != (Object)null) ? ((Component)attachedRigidbody).transform : ((Component)val2).transform);
		Vector3 position = obj.position;
		Vector3 position2 = val.position;
		Bounds bounds = val2.bounds;
		obj.position = position + (position2 - ((Bounds)(ref bounds)).center);
		if ((Object)(object)attachedRigidbody != (Object)null && !attachedRigidbody.isKinematic)
		{
			attachedRigidbody.velocity = Vector3.zero;
			attachedRigidbody.angularVelocity = Vector3.zero;
		}
		Physics.SyncTransforms();
	}

	private static void handsinfront()
	{
		//IL_004d: 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_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: 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_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_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: 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_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: 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_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		if (UnityXRManager.CurrentInputSubsystem != null)
		{
			return;
		}
		CameraRig instance = MonoBehaviourSingleton<CameraRig>.Instance;
		if ((Object)(object)instance == (Object)null)
		{
			return;
		}
		Vector3 val = (((Object)(object)instance.UnityXRHmdTransform != (Object)null) ? instance.UnityXRHmdTransform.position : (((Component)instance).transform.position + Vector3.up * heighttt));
		Quaternion val2 = (lastheadrott = Quaternion.Euler(0f, ((Component)instance).transform.eulerAngles.y, 0f) * Quaternion.Euler(pitchhh, 0f, 0f));
		if ((Object)(object)instance.UnityXRHmdTransform != (Object)null)
		{
			instance.UnityXRHmdTransform.localRotation = Quaternion.Euler(pitchhh, 0f, 0f);
		}
		float num = Mathf.Clamp01(Mathf.InverseLerp(daconfihandminn.Value, daconfihandstartt.Value, handdistt));
		float num2 = 0.2f * num;
		float num3 = -0.25f * num;
		Vector3 pos = val + val2 * (new Vector3(num2, num3, handdistt + 1f * punchamountt(punchrightat)) + throwoffsett(throwrightat));
		Vector3 pos2 = val + val2 * (new Vector3(0f - num2, num3, handdistt + 1f * punchamountt(punchleftat)) + throwoffsett(throwleftat));
		puttt(instance.UnityXRRightControllerTransform, pos, val2);
		puttt(instance.UnityXRLeftControllerTransform, pos2, val2);
		for (int i = 0; i < VRHandController.all.Count; i++)
		{
			VRHandController val3 = VRHandController.all[i];
			if ((Object)(object)val3 != (Object)null && (Object)(object)val3.CurrentController != (Object)null)
			{
				val3.CurrentController.isTracked = true;
			}
		}
	}

	public static Vector3 fakevelocity(Controller controller, bool localll)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Invalid comparison between Unknown and I4
		//IL_0007: 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_0013: Invalid comparison between Unknown and I4
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Invalid comparison between Unknown and I4
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Invalid comparison between Unknown and I4
		//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_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: 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_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: 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_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: 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_00cd: 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_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)
		if (UnityXRManager.CurrentInputSubsystem != null)
		{
			return Vector3.zero;
		}
		bool flag = (int)controller == 2 || (int)controller == 3;
		bool flag2 = (int)controller == 1 || (int)controller == 3;
		Vector3 val = Vector3.zero;
		if (flag)
		{
			val = throwvelocityy(throwrightat);
		}
		if (val == Vector3.zero && flag2)
		{
			val = throwvelocityy(throwleftat);
		}
		if (val == Vector3.zero)
		{
			float num = -10f;
			if (flag && Time.unscaledTime - punchrightat < 0.38f)
			{
				num = punchrightat;
			}
			else if (flag2 && Time.unscaledTime - punchleftat < 0.38f)
			{
				num = punchleftat;
			}
			float num2 = Time.unscaledTime - num - 0.1f;
			if (num2 < 0f || num2 > 0.28f)
			{
				return Vector3.zero;
			}
			val = lastheadrott * Vector3.forward * ((num2 < 0.08f) ? 12.5f : (-5f));
		}
		if (localll)
		{
			CameraRig instance = MonoBehaviourSingleton<CameraRig>.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				val = ((Component)instance).transform.InverseTransformDirection(val);
			}
		}
		return val;
	}

	public static bool fakepress(Controller controller, Axis axis, int modee)
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Invalid comparison between Unknown and I4
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Invalid comparison between Unknown and I4
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Invalid comparison between Unknown and I4
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Invalid comparison between Unknown and I4
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Invalid comparison between Unknown and I4
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Invalid comparison between Unknown and I4
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Invalid comparison between Unknown and I4
		if (Mouse.current == null || Keyboard.current == null)
		{
			return false;
		}
		VRInputManager instance = VRInputManager.Instance;
		if ((Object)(object)instance == (Object)null || !instance.HandsPrepared || VRHandController.all.Count == 0)
		{
			return false;
		}
		bool flag = (int)controller == 2 || (int)controller == 3;
		bool flag2 = (int)controller == 1 || (int)controller == 3;
		bool flag3 = false;
		if ((int)axis == 8)
		{
			bool flag4 = daconfitriggerr.Value == daconfitriggerleftt.Value;
			if (flag && (!flag4 || gripholdd[1] || !gripholdd[0]))
			{
				flag3 |= bindmodee(daconfitriggerr, modee);
			}
			if (flag2 && (!flag4 || gripholdd[0]))
			{
				flag3 |= bindmodee(daconfitriggerleftt, modee);
			}
		}
		if ((int)axis == 16)
		{
			if (flag)
			{
				flag3 |= gripsidee(1, modee);
			}
			if (flag2)
			{
				flag3 |= gripsidee(0, modee);
			}
		}
		if ((int)axis == 16 && modee == 0)
		{
			if (flag && Time.unscaledTime - punchrightat < 0.6f)
			{
				flag3 = true;
			}
			if (flag2 && Time.unscaledTime - punchleftat < 0.6f)
			{
				flag3 = true;
			}
		}
		return flag3;
	}

	private static void makeheadsetfakee()
	{
		if (Time.unscaledTime < nexttimeidk)
		{
			return;
		}
		nexttimeidk = Time.unscaledTime + 1f;
		if (UnityXRManager.CurrentInputSubsystem == null)
		{
			CameraRig._devMoveEnabled = true;
			UnityXRManager instance = UnityXRManager.Instance;
			if ((Object)(object)instance != (Object)null && (Delegate)(object)instance.m_HMDMountedStateChanged != (Delegate)null)
			{
				instance.m_HMDMountedStateChanged.Invoke(true);
			}
		}
	}

	private static void itstimeforwasd()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: 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_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: 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_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		if (UnityXRManager.CurrentInputSubsystem != null)
		{
			return;
		}
		CameraRig instance = MonoBehaviourSingleton<CameraRig>.Instance;
		if (!((Object)(object)instance == (Object)null))
		{
			Transform transform = ((Component)instance).transform;
			Mouse current = Mouse.current;
			if (!gotyawww)
			{
				gotyawww = true;
				yawww = transform.eulerAngles.y;
			}
			if (current != null && mouselockedd && relockk == 0 && Application.isFocused)
			{
				Vector2 val = ((InputControl<Vector2>)(object)((Pointer)current).delta).ReadValue();
				yawww += val.x * daconfisensss.Value;
				pitchhh = Mathf.Clamp(pitchhh - val.y * daconfisensss.Value, -89f, 89f);
				transform.rotation = Quaternion.Euler(0f, yawww, 0f);
			}
			if ((Object)(object)instance.Head != (Object)null)
			{
				instance.Head.localRotation = Quaternion.Euler(pitchhh, 0f, 0f);
			}
			Vector3 val2 = Vector3.zero;
			if (heldd(daconfiforwardd))
			{
				val2 += transform.forward;
			}
			if (heldd(daconfibackk))
			{
				val2 -= transform.forward;
			}
			if (heldd(daconfirightt))
			{
				val2 += transform.right;
			}
			if (heldd(daconfileftt))
			{
				val2 -= transform.right;
			}
			val2.y = 0f;
			if (val2 != Vector3.zero)
			{
				transform.position += ((Vector3)(ref val2)).normalized * daconfispeedd.Value * Time.unscaledDeltaTime;
			}
		}
	}
}
[HarmonyPatch(typeof(ActionInputSystem), "GetPress")]
public static class rpessittt
{
	public static void Postfix(Controller controller, Axis axis, ref bool __result)
	{
		//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)
		if (UnityXRManager.CurrentInputSubsystem == null && mainclass.fakepress(controller, axis, 0))
		{
			__result = true;
		}
	}
}
[HarmonyPatch(typeof(ActionInputSystem), "GetPressDown")]
public static class dapresdown
{
	public static void Postfix(Controller controller, Axis axis, ref bool __result)
	{
		//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)
		if (UnityXRManager.CurrentInputSubsystem == null && mainclass.fakepress(controller, axis, 1))
		{
			__result = true;
		}
	}
}
[HarmonyPatch(typeof(ActionInputSystem), "GetPressUp")]
public static class dapresup
{
	public static void Postfix(Controller controller, Axis axis, ref bool __result)
	{
		//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)
		if (UnityXRManager.CurrentInputSubsystem == null && mainclass.fakepress(controller, axis, 2))
		{
			__result = true;
		}
	}
}
[HarmonyPatch(typeof(ActionInputSystem), "GetValue")]
public static class davall
{
	public static void Postfix(Controller controller, Axis axis, ref float __result)
	{
		//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)
		if (UnityXRManager.CurrentInputSubsystem == null && mainclass.fakepress(controller, axis, 0))
		{
			__result = 1f;
		}
	}
}
[HarmonyPatch(typeof(ActionInputSystem), "GetLocalVelocity")]
public static class dalocalspeedd
{
	public static void Postfix(Controller controller, ref Vector3 __result)
	{
		//IL_0000: 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)
		//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)
		Vector3 val = mainclass.fakevelocity(controller, localll: true);
		if (val != Vector3.zero)
		{
			__result = val;
		}
	}
}
[HarmonyPatch(typeof(VRInputManager), "GetLocalVelocity")]
public static class dalocalspe
{
	public static void Postfix(Controller controller, ref Vector3 __result)
	{
		//IL_0000: 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)
		//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)
		Vector3 val = mainclass.fakevelocity(controller, localll: true);
		if (val != Vector3.zero)
		{
			__result = val;
		}
	}
}
[HarmonyPatch(typeof(VRInputManager), "GetRawVelocity")]
public static class dasperaww
{
	public static void Postfix(Controller controller, ref Vector3 __result)
	{
		//IL_0000: 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)
		//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)
		Vector3 val = mainclass.fakevelocity(controller, localll: false);
		if (val != Vector3.zero)
		{
			__result = val;
		}
	}
}
[HarmonyPatch(typeof(VRInputManager), "GetAimVelocity")]
public static class daaimspee
{
	public static void Postfix(Controller controller, ref Vector3 __result)
	{
		//IL_0000: 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)
		//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)
		Vector3 val = mainclass.fakevelocity(controller, localll: false);
		if (val != Vector3.zero)
		{
			__result = val;
		}
	}
}