Decompiled source of REPO SteamInput v1.0.1

REPO SteamInput.dll

Decompiled 18 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using REPO_SteamInput.Data;
using Sirenix.Utilities;
using Steamworks;
using Steamworks.Data;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.TextCore;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: AssemblyCompany("slenered")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+8f25e184a1e1db805ec84491da8b4b79a90c2f77")]
[assembly: AssemblyProduct("REPO SteamInput")]
[assembly: AssemblyTitle("REPO SteamInput")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 REPO_SteamInput
{
	public class FileSystem
	{
		internal static void CopyDirectory(string source, string destination, bool overwrite = false)
		{
			if (!Directory.Exists(destination))
			{
				Directory.CreateDirectory(destination);
			}
			else if (overwrite)
			{
				string[] files = Directory.GetFiles(destination);
				if (!Directory.Exists(destination + "\\backup"))
				{
					Directory.CreateDirectory(destination + "\\backup");
				}
				string[] array = files;
				foreach (string text in array)
				{
					File.Copy(text, Path.Combine(destination + "\\backup", Path.GetFileName(text)), overwrite: true);
				}
			}
			string[] files2 = Directory.GetFiles(source);
			string[] array2 = files2;
			foreach (string text2 in array2)
			{
				File.Copy(text2, Path.Combine(destination, Path.GetFileName(text2)), overwrite);
			}
		}
	}
	internal static class BuildInfo
	{
		public const string Version = "1.0.1";
	}
	[StructLayout(LayoutKind.Sequential, Size = 1)]
	public struct InputStore
	{
		internal static InputActionSetHandle_t ActionSetGameControls = SteamInput.Internal.GetActionSetHandle("GameControls");

		internal static InputActionSetHandle_t ActionSetMenuControls = SteamInput.Internal.GetActionSetHandle("MenuControls");

		internal static InputActionSetHandle_t ActionSetSpectatorControls = SteamInput.Internal.GetActionSetHandle("SpectatorControls");

		internal static InputActionSetHandle_t ActionSetItemDistanceLayer = SteamInput.Internal.GetActionSetHandle("ItemDistanceLayer");

		internal static InputActionSetHandle_t ActionSetItemRotateLayer = SteamInput.Internal.GetActionSetHandle("ItemRotateLayer");

		internal static ActionHandle ActionInteract = SteamInputHandler.GetDigitalActionHandle("Interact");

		internal static ActionHandle ActionChat = SteamInputHandler.GetDigitalActionHandle("Chat");

		internal static ActionHandle ActionChatDelete = SteamInputHandler.GetDigitalActionHandle("ChatDelete");

		internal static ActionHandle ActionToggleMute = SteamInputHandler.GetDigitalActionHandle("ToggleMute");

		internal static ActionHandle ActionPushToTalk = SteamInputHandler.GetDigitalActionHandle("PushToTalk");

		internal static ActionHandle ActionJump = SteamInputHandler.GetDigitalActionHandle("Jump");

		internal static ActionHandle ActionCrouch = SteamInputHandler.GetDigitalActionHandle("Crouch");

		internal static ActionHandle ActionSprint = SteamInputHandler.GetDigitalActionHandle("Sprint");

		internal static ActionHandle ActionGrab = SteamInputHandler.GetDigitalActionHandle("Grab");

		internal static ActionHandle ActionRotate = SteamInputHandler.GetDigitalActionHandle("Rotate");

		internal static ActionHandle ActionPush = SteamInputHandler.GetDigitalActionHandle("Push");

		internal static ActionHandle ActionPull = SteamInputHandler.GetDigitalActionHandle("Pull");

		internal static ActionHandle ActionPushPullLayer = SteamInputHandler.GetDigitalActionHandle("PushPullLayer");

		internal static ActionHandle ActionTumble = SteamInputHandler.GetDigitalActionHandle("Tumble");

		internal static ActionHandle ActionInventory1 = SteamInputHandler.GetDigitalActionHandle("Inventory1");

		internal static ActionHandle ActionInventory2 = SteamInputHandler.GetDigitalActionHandle("Inventory2");

		internal static ActionHandle ActionInventory3 = SteamInputHandler.GetDigitalActionHandle("Inventory3");

		internal static ActionHandle ActionMap = SteamInputHandler.GetDigitalActionHandle("Map");

		internal static ActionHandle ActionMenu = SteamInputHandler.GetDigitalActionHandle("pause_menu");

		internal static ActionHandle ExpressionNone = SteamInputHandler.GetDigitalActionHandle("ExpressionNone");

		internal static ActionHandle Expression1 = SteamInputHandler.GetDigitalActionHandle("Expression1");

		internal static ActionHandle Expression2 = SteamInputHandler.GetDigitalActionHandle("Expression2");

		internal static ActionHandle Expression3 = SteamInputHandler.GetDigitalActionHandle("Expression3");

		internal static ActionHandle Expression4 = SteamInputHandler.GetDigitalActionHandle("Expression4");

		internal static ActionHandle Expression5 = SteamInputHandler.GetDigitalActionHandle("Expression5");

		internal static ActionHandle Expression6 = SteamInputHandler.GetDigitalActionHandle("Expression6");

		internal static ActionHandle AnalogActionMove = SteamInputHandler.GetAnalogActionHandle("Move");

		internal static ActionHandle AnalogActionCamera = SteamInputHandler.GetAnalogActionHandle("Camera");

		internal static ActionHandle AnalogActionItemDistance = SteamInputHandler.GetAnalogActionHandle("ItemDistance");

		internal static ActionHandle AnalogActionItemRotate = SteamInputHandler.GetAnalogActionHandle("ItemRotate");

		internal static ActionHandle ActionSpectateNext = SteamInputHandler.GetDigitalActionHandle("SpectateNext");

		internal static ActionHandle ActionSpectatePrevious = SteamInputHandler.GetDigitalActionHandle("SpectatePrevious");

		internal static ActionHandle AnalogActionZoom = SteamInputHandler.GetAnalogActionHandle("Zoom");

		internal static ActionHandle MenuUp = SteamInputHandler.GetDigitalActionHandle("menu_up");

		internal static ActionHandle MenuDown = SteamInputHandler.GetDigitalActionHandle("menu_down");

		internal static ActionHandle MenuLeft = SteamInputHandler.GetDigitalActionHandle("menu_left");

		internal static ActionHandle MenuRight = SteamInputHandler.GetDigitalActionHandle("menu_right");

		internal static ActionHandle MenuSelect = SteamInputHandler.GetDigitalActionHandle("menu_select");

		internal static ActionHandle MenuCancel = SteamInputHandler.GetDigitalActionHandle("menu_cancel");

		internal static ActionHandle AnalogActionMenuScroll = SteamInputHandler.GetAnalogActionHandle("menu_scroll");

		public static TMP_SpriteAsset GlyphSpriteSheet = null;

		public static Dictionary<InputAction, ActionHandle>? InputActionForSteam;

		public static readonly Dictionary<InputKey, ActionHandle> InputNameForSteam = new Dictionary<InputKey, ActionHandle>
		{
			{
				(InputKey)2,
				ActionInteract
			},
			{
				(InputKey)1,
				ActionJump
			},
			{
				(InputKey)7,
				ActionChat
			},
			{
				(InputKey)13,
				ActionChatDelete
			},
			{
				(InputKey)32,
				ActionToggleMute
			},
			{
				(InputKey)25,
				ActionPushToTalk
			},
			{
				(InputKey)15,
				ActionSprint
			},
			{
				(InputKey)12,
				ActionCrouch
			},
			{
				(InputKey)10,
				ActionGrab
			},
			{
				(InputKey)11,
				ActionRotate
			},
			{
				(InputKey)4,
				ActionPush
			},
			{
				(InputKey)5,
				ActionPull
			},
			{
				(InputKey)14,
				ActionTumble
			},
			{
				(InputKey)23,
				ActionSpectateNext
			},
			{
				(InputKey)24,
				ActionSpectatePrevious
			},
			{
				(InputKey)19,
				ActionInventory1
			},
			{
				(InputKey)20,
				ActionInventory2
			},
			{
				(InputKey)21,
				ActionInventory3
			},
			{
				(InputKey)8,
				ActionMap
			},
			{
				(InputKey)6,
				ActionMenu
			},
			{
				(InputKey)9,
				MenuSelect
			},
			{
				(InputKey)18,
				MenuCancel
			},
			{
				(InputKey)26,
				Expression1
			},
			{
				(InputKey)27,
				Expression2
			},
			{
				(InputKey)28,
				Expression3
			},
			{
				(InputKey)29,
				Expression4
			},
			{
				(InputKey)30,
				Expression5
			},
			{
				(InputKey)31,
				Expression6
			},
			{
				(InputKey)0,
				AnalogActionMove
			},
			{
				(InputKey)17,
				AnalogActionItemDistance
			},
			{
				(InputKey)3,
				AnalogActionCamera
			},
			{
				(InputKey)16,
				AnalogActionCamera
			}
		};

		public static readonly Dictionary<InputDigitalActionHandle_t, InputAnalogActionHandle_t> AnalogDigitalActions = new Dictionary<InputDigitalActionHandle_t, InputAnalogActionHandle_t>
		{
			{ ActionPush.DigitalActionHandle, AnalogActionItemDistance.AnalogActionHandle },
			{ ActionPull.DigitalActionHandle, AnalogActionItemDistance.AnalogActionHandle }
		};

		public static readonly Dictionary<InputDigitalActionHandle_t, ButtonState> InputDown = new Dictionary<InputDigitalActionHandle_t, ButtonState>
		{
			{
				ActionInteract.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionJump.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionChat.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionChatDelete.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionToggleMute.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionPushToTalk.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionSprint.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionCrouch.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionGrab.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionRotate.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionPushPullLayer.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionPush.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionPull.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionTumble.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionSpectateNext.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionSpectatePrevious.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionInventory1.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionInventory2.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionInventory3.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionMap.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ActionMenu.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				ExpressionNone.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				Expression1.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				Expression2.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				Expression3.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				Expression4.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				Expression5.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				Expression6.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				MenuUp.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				MenuDown.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				MenuLeft.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				MenuRight.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				MenuSelect.DigitalActionHandle,
				ButtonState.Normal
			},
			{
				MenuCancel.DigitalActionHandle,
				ButtonState.Normal
			}
		};

		public static Dictionary<ActionHandle, InputActionSetHandle_t[]> InputForActionSet = new Dictionary<ActionHandle, InputActionSetHandle_t[]>
		{
			{
				ActionInteract,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[2] { ActionSetGameControls, ActionSetSpectatorControls }
			},
			{
				ActionJump,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				ActionCrouch,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				ActionSprint,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				ActionGrab,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				ActionRotate,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				ActionPush,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				ActionPull,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				ActionPushPullLayer,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				ActionTumble,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				ActionInventory1,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				ActionInventory2,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				ActionInventory3,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				ActionMap,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				ExpressionNone,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				Expression1,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				Expression2,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				Expression3,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				Expression4,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				Expression5,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				Expression6,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				ActionMenu,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[2] { ActionSetGameControls, ActionSetSpectatorControls }
			},
			{
				ActionChat,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[3] { ActionSetGameControls, ActionSetMenuControls, ActionSetSpectatorControls }
			},
			{
				ActionChatDelete,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[3] { ActionSetGameControls, ActionSetMenuControls, ActionSetSpectatorControls }
			},
			{
				ActionToggleMute,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[2] { ActionSetGameControls, ActionSetSpectatorControls }
			},
			{
				ActionPushToTalk,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[2] { ActionSetGameControls, ActionSetSpectatorControls }
			},
			{
				AnalogActionMove,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				AnalogActionCamera,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				AnalogActionItemDistance,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				AnalogActionItemRotate,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetGameControls }
			},
			{
				ActionSpectateNext,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetSpectatorControls }
			},
			{
				ActionSpectatePrevious,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetSpectatorControls }
			},
			{
				AnalogActionZoom,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetSpectatorControls }
			},
			{
				MenuUp,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetMenuControls }
			},
			{
				MenuDown,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetMenuControls }
			},
			{
				MenuLeft,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetMenuControls }
			},
			{
				MenuRight,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetMenuControls }
			},
			{
				MenuSelect,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetMenuControls }
			},
			{
				MenuCancel,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetMenuControls }
			},
			{
				AnalogActionMenuScroll,
				(InputActionSetHandle_t[])(object)new InputActionSetHandle_t[1] { ActionSetMenuControls }
			}
		};

		public static Dictionary<InputActionSetHandle_t, (InputActionSetHandle_t, InputDigitalActionHandle_t)[]?> ActionLayersForSets = new Dictionary<InputActionSetHandle_t, (InputActionSetHandle_t, InputDigitalActionHandle_t)[]> { 
		{
			ActionSetGameControls,
			new(InputActionSetHandle_t, InputDigitalActionHandle_t)[2]
			{
				(ActionSetItemDistanceLayer, ActionPushPullLayer.DigitalActionHandle),
				(ActionSetItemRotateLayer, ActionRotate.DigitalActionHandle)
			}
		} };

		public static Dictionary<InputDigitalActionHandle_t, (InputActionSetHandle_t, InputDigitalActionHandle_t)> ActionLayersForInput = new Dictionary<InputDigitalActionHandle_t, (InputActionSetHandle_t, InputDigitalActionHandle_t)>
		{
			{
				ActionPush.DigitalActionHandle,
				(ActionSetItemDistanceLayer, ActionPushPullLayer.DigitalActionHandle)
			},
			{
				ActionPull.DigitalActionHandle,
				(ActionSetItemDistanceLayer, ActionPushPullLayer.DigitalActionHandle)
			}
		};

		public static Dictionary<InputActionSetHandle_t, ActionHandle[]> RelatedInputsForActionLayer = new Dictionary<InputActionSetHandle_t, ActionHandle[]> { 
		{
			ActionSetItemDistanceLayer,
			new ActionHandle[3] { AnalogActionItemDistance, ActionPush, ActionPull }
		} };

		public static readonly ActionHandle[] AllInputs = new ActionHandle[40]
		{
			ActionInteract, ActionChat, ActionChatDelete, ActionToggleMute, ActionPushToTalk, ActionJump, ActionCrouch, ActionSprint, ActionGrab, ActionRotate,
			ActionPush, ActionPull, ActionPushPullLayer, ActionTumble, ActionInventory1, ActionInventory2, ActionInventory3, ActionMap, ActionMenu, ExpressionNone,
			Expression1, Expression2, Expression3, Expression4, Expression5, Expression6, AnalogActionMove, AnalogActionCamera, AnalogActionItemDistance, AnalogActionItemRotate,
			ActionSpectateNext, ActionSpectatePrevious, AnalogActionZoom, MenuUp, MenuDown, MenuLeft, MenuRight, MenuSelect, MenuCancel, AnalogActionMenuScroll
		};

		public static readonly InputDigitalActionHandle_t[] ExpressionInputs = (InputDigitalActionHandle_t[])(object)new InputDigitalActionHandle_t[6] { Expression1.DigitalActionHandle, Expression2.DigitalActionHandle, Expression3.DigitalActionHandle, Expression4.DigitalActionHandle, Expression5.DigitalActionHandle, Expression6.DigitalActionHandle };

		public static readonly Dictionary<ActionHandle, string> GlyphInputs = new Dictionary<ActionHandle, string>();

		internal static void GenerateInputActions(Dictionary<InputKey, InputAction> inputActions)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			InputActionForSteam = new Dictionary<InputAction, ActionHandle>();
			foreach (KeyValuePair<InputKey, ActionHandle> item in InputNameForSteam)
			{
				InputActionForSteam.Add(inputActions[item.Key], item.Value);
			}
		}

		internal static void GenerateAllGlyphs()
		{
			string directoryName = Path.GetDirectoryName(SteamInput.Internal.GetGlyphForActionOrigin_Legacy((InputActionOrigin)1));
			HashSet<string> hashSet = new HashSet<string>();
			string item = Path.GetDirectoryName(((BaseUnityPlugin)REPO_SteamInput.Instance).Info.Location) + "\\textures\\button_none.png";
			hashSet.Add(item);
			LinqExtensions.AddRange<string>(hashSet, (IEnumerable<string>)Directory.GetFiles(directoryName));
			hashSet.RemoveWhere((string s) => !s.Contains("_md") || s.Contains("mouse"));
			GlyphSpriteSheet = SpriteFactory.BuildFromFiles(hashSet.ToArray());
		}
	}
	[BepInPlugin("slenered.REPO_SteamInput", "REPO SteamInput", "1.0.1")]
	public class REPO_SteamInput : BaseUnityPlugin
	{
		private static class MenuPatches
		{
			[HarmonyPatch(typeof(MenuButton), "HoverLogic")]
			[HarmonyTranspiler]
			internal static IEnumerable<CodeInstruction> MenuButton_HoverLogic(IEnumerable<CodeInstruction> instructions)
			{
				//IL_0003: 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_0038: Expected O, but got Unknown
				return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(Input), "GetMouseButtonDown", (Type[])null, (Type[])null), (string)null)
				}).Advance(-1).SetOpcodeAndAdvance(OpCodes.Nop)
					.SetOperandAndAdvance((object)AccessTools.Method(typeof(MenuPatches), "GetMouseOrButtonDownZero", (Type[])null, (Type[])null))
					.InstructionEnumeration();
			}

			internal static bool GetMouseOrButtonDownZero()
			{
				return Input.GetMouseButtonDown(0) || SemiFunc.InputDown((InputKey)9);
			}

			[HarmonyPatch(typeof(SemiFunc), "UIMouseHover")]
			[HarmonyPrefix]
			internal static bool UIMouseHover(MenuPage parentPage, RectTransform rectTransform, string menuID, float xPadding, float yPadding, ref bool __result)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Invalid comparison between Unknown and I4
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Invalid comparison between Unknown and I4
				if (!controllerActive)
				{
					return true;
				}
				__result = ((int)parentPage.currentPageState == 1 || (parentPage.addedPageOnTop && (int)parentPage.parentPage.currentPageState == 1)) && ActiveButtons.TryGetValue((MenuPage)((!parentPage.addedPageOnTop) ? ((object)parentPage) : ((object)parentPage.parentPage)), out MenuSelectableElement value) && value.menuID == menuID;
				return false;
			}

			[HarmonyPatch(typeof(MenuElementHover), "Update")]
			[HarmonyTranspiler]
			internal static IEnumerable<CodeInstruction> MenuElementHover_Update(IEnumerable<CodeInstruction> instructions)
			{
				//IL_0003: 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_0038: Expected O, but got Unknown
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: Expected O, but got Unknown
				return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(SemiFunc), "UIMouseHover", (Type[])null, (Type[])null), (string)null)
				}).Advance(-3).SetAndAdvance(OpCodes.Ldfld, (object)AccessTools.Field(typeof(MenuElementHover), "menuSelectableElement"))
					.Insert((CodeInstruction[])(object)new CodeInstruction[1]
					{
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MenuPatches), "MenuIDorEmpty", (Type[])null, (Type[])null))
					})
					.InstructionEnumeration();
			}

			internal static string MenuIDorEmpty(MenuSelectableElement menuSelectableElement)
			{
				return ((Object)(object)menuSelectableElement != (Object)null) ? menuSelectableElement.menuID : "";
			}

			[HarmonyPatch(typeof(MenuManager), "PageAddOnTop")]
			[HarmonyPostfix]
			internal static void PageAddOnTop(MenuManager __instance, MenuPageIndex menuPageIndex, ref MenuPage __result)
			{
				openedOnTop = true;
			}

			[HarmonyPatch(typeof(MenuPage), "Update")]
			[HarmonyPostfix]
			internal static void MenuUpdate(MenuPage __instance)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Invalid comparison between Unknown and I4
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Invalid comparison between Unknown and I4
				//IL_0277: Unknown result type (might be due to invalid IL or missing references)
				//IL_0281: Expected O, but got Unknown
				//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e7: Expected O, but got Unknown
				//IL_0336: Unknown result type (might be due to invalid IL or missing references)
				//IL_0487: 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_03e8: Invalid comparison between Unknown and I4
				//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
				MenuPage __instance2 = __instance;
				if ((int)__instance2.currentPageState != 1 || __instance2.addedPageOnTop)
				{
					return;
				}
				List<MenuSelectableElement> list = new List<MenuSelectableElement>(__instance2.selectableElements);
				if (MenuManager.instance.addedPagesOnTop.Count > 0)
				{
					foreach (MenuPage item in MenuManager.instance.addedPagesOnTop.Where((MenuPage page) => (Object)(object)__instance2 != (Object)(object)page))
					{
						list.AddRange(item.selectableElements);
					}
				}
				if ((int)__instance2.menuPageIndex == 11)
				{
					MenuPageSaves component = ((Component)__instance2).GetComponent<MenuPageSaves>();
					list.Remove(((Component)component.saveFileInfoRow1).GetComponent<MenuSelectableElement>());
					list.Remove(((Component)component.saveFileInfoRow2).GetComponent<MenuSelectableElement>());
					list.Remove(((Component)component.saveFileInfoRow3).GetComponent<MenuSelectableElement>());
					list.Remove(((Component)component.saveFileInfoMoonRect).GetComponent<MenuSelectableElement>());
					list.Remove(((Component)component.saveFileInfoMoonText).GetComponent<MenuSelectableElement>());
					list.Remove(((Component)component.saveFileInfoMoonImage).GetComponent<MenuSelectableElement>());
				}
				MenuScrollBox componentInChildren = ((Component)__instance2).GetComponentInChildren<MenuScrollBox>();
				if ((Object)(object)componentInChildren == (Object)null && MenuManager.instance.addedPagesOnTop.Count > 0)
				{
					foreach (MenuPage item2 in MenuManager.instance.addedPagesOnTop.Where((MenuPage page) => (Object)(object)__instance2 != (Object)(object)page))
					{
						componentInChildren = ((Component)item2).GetComponentInChildren<MenuScrollBox>();
						if ((Object)(object)componentInChildren != (Object)null)
						{
							break;
						}
					}
				}
				if ((Object)(object)componentInChildren != (Object)null)
				{
					MenuSelectableElement[] componentsInChildren = componentInChildren.scrollBar.GetComponentsInChildren<MenuSelectableElement>();
					foreach (MenuSelectableElement val in componentsInChildren)
					{
						if (!((Object)(object)val == (Object)null))
						{
							list.Remove(val);
						}
					}
					Component val2 = default(Component);
					if (componentInChildren.scrollBar.TryGetComponent(typeof(MenuSelectableElement), ref val2))
					{
						list.Remove((MenuSelectableElement)val2);
					}
				}
				Component val3 = default(Component);
				Component val5 = default(Component);
				Component val6 = default(Component);
				foreach (MenuSelectableElement item3 in new List<MenuSelectableElement>(list).Where((MenuSelectableElement selectableElement) => Object.op_Implicit((Object)(object)selectableElement)))
				{
					if (((Component)item3).TryGetComponent(typeof(MenuSlider), ref val3))
					{
						MenuSlider val4 = (MenuSlider)val3;
						MenuSelectableElement component2 = ((Component)val4.barSize).GetComponent<MenuSelectableElement>();
						list.Remove(item3);
						list.Remove(component2);
					}
					else if (((Component)item3).TryGetComponent(typeof(MenuTwoOptions), ref val5) || (((Component)item3).TryGetComponent(typeof(CanvasGroup), ref val6) && ((CanvasGroup)val6).alpha < 0.5f) || !((Behaviour)item3).isActiveAndEnabled)
					{
						list.Remove(item3);
					}
				}
				if (!ActiveButtons.ContainsKey(__instance2))
				{
					ActiveButtons.Add(__instance2, list[0]);
				}
				else if (openedOnTop && MenuManager.instance.addedPagesOnTop.Count > 0 && (int)MenuManager.instance.addedPagesOnTop[0].currentPageState > 2)
				{
					ActiveButtons[__instance2] = MenuManager.instance.addedPagesOnTop[0].selectableElements[0];
					openedOnTop = false;
				}
				else if ((Object)(object)ActiveButtons[__instance2] == (Object)null || !list.Contains(ActiveButtons[__instance2]))
				{
					ActiveButtons[__instance2] = list[0];
				}
				if (InputStore.InputDown[InputStore.MenuSelect.DigitalActionHandle] == ButtonState.Pressed && clickCooldown <= 0f)
				{
					clickCooldown = 0.25f;
					controllerRumbleTime = 0.1f;
					SteamInput.Internal.TriggerVibration(controller.Handle, (ushort)16383, (ushort)16383);
				}
				if (clickCooldown > 0f)
				{
					clickCooldown -= Time.deltaTime;
				}
				else
				{
					UpdateMenuSelect(__instance2, componentInChildren, list);
				}
			}

			[HarmonyPatch(typeof(MenuPage), "StateClosing")]
			[HarmonyPostfix]
			internal static void MenuPageStateClosing(MenuPage __instance)
			{
				ActiveButtons.Remove(__instance);
			}

			private static void UpdateMenuSelect(MenuPage menuPage, MenuScrollBox? scrollableMenu, List<MenuSelectableElement> selectableElements)
			{
				//IL_000b: 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_0020: 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_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				if (InputStore.InputDown[InputStore.MenuUp.DigitalActionHandle] >= ButtonState.Pressed)
				{
					MoveSelection(Vector2.up, menuPage, scrollableMenu, selectableElements);
				}
				if (InputStore.InputDown[InputStore.MenuDown.DigitalActionHandle] >= ButtonState.Pressed)
				{
					MoveSelection(Vector2.down, menuPage, scrollableMenu, selectableElements);
				}
				if (InputStore.InputDown[InputStore.MenuRight.DigitalActionHandle] >= ButtonState.Pressed)
				{
					MoveSelection(Vector2.right, menuPage, scrollableMenu, selectableElements);
				}
				if (InputStore.InputDown[InputStore.MenuLeft.DigitalActionHandle] >= ButtonState.Pressed)
				{
					MoveSelection(Vector2.left, menuPage, scrollableMenu, selectableElements);
				}
			}

			private static void MoveSelection(Vector2 direction, MenuPage menuPage, MenuScrollBox? scrollableMenu, List<MenuSelectableElement> selectableElements)
			{
				//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_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_00f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_012b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0130: Unknown result type (might be due to invalid IL or missing references)
				//IL_0272: 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_016a: Unknown result type (might be due to invalid IL or missing references)
				//IL_029a: Unknown result type (might be due to invalid IL or missing references)
				//IL_029f: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a4: 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_02c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_038b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0390: Unknown result type (might be due to invalid IL or missing references)
				//IL_034f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0354: Unknown result type (might be due to invalid IL or missing references)
				//IL_033d: 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_035a: Unknown result type (might be due to invalid IL or missing references)
				//IL_035f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0364: Unknown result type (might be due to invalid IL or missing references)
				//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_04be: Unknown result type (might be due to invalid IL or missing references)
				//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_045c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0461: Unknown result type (might be due to invalid IL or missing references)
				//IL_0467: Unknown result type (might be due to invalid IL or missing references)
				//IL_046c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0412: Unknown result type (might be due to invalid IL or missing references)
				//IL_0400: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c4: 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_03bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_0493: Unknown result type (might be due to invalid IL or missing references)
				//IL_0417: Unknown result type (might be due to invalid IL or missing references)
				//IL_041d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0422: Unknown result type (might be due to invalid IL or missing references)
				//IL_0428: 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_04a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_049b: Unknown result type (might be due to invalid IL or missing references)
				//IL_055c: Unknown result type (might be due to invalid IL or missing references)
				//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0646: Unknown result type (might be due to invalid IL or missing references)
				//IL_0623: Unknown result type (might be due to invalid IL or missing references)
				//IL_06b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_05e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_05e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0671: Unknown result type (might be due to invalid IL or missing references)
				//IL_0676: Unknown result type (might be due to invalid IL or missing references)
				MenuSelectableElement ActiveButton = ActiveButtons[menuPage];
				MenuPlayerListed componentInParent = ((Component)ActiveButton).GetComponentInParent<MenuPlayerListed>();
				if ((direction == Vector2.left || direction == Vector2.right) && (Object)(object)componentInParent != (Object)null)
				{
					MonoBehaviour.print((object)"MenuPlayerListed");
					switch (((Object)ActiveButton).name)
					{
					case "Button":
						if (((Object)((Component)ActiveButton).transform.parent.parent).name == "Player UI Head" && direction == Vector2.left)
						{
							ActiveButton = ((Component)((Component)componentInParent).transform.GetChild(5).GetChild(6)).GetComponent<MenuSelectableElement>();
						}
						break;
					case "Menu Button - x":
						if (direction == Vector2.right)
						{
							ActiveButton = ((Component)((Component)componentInParent).transform.GetChild(5).GetChild(5)).GetComponent<MenuSelectableElement>();
						}
						break;
					case "Menu Button - <":
						if (direction == Vector2.left)
						{
							ActiveButton = ((Component)((Component)componentInParent).transform.GetChild(3).GetChild(0)).GetComponent<MenuSelectableElement>();
						}
						else
						{
							ActiveButton = ((Component)((Component)componentInParent).transform.GetChild(5).GetChild(6)).GetComponent<MenuSelectableElement>();
						}
						break;
					case "Menu Button - >":
						if (direction == Vector2.left)
						{
							ActiveButton = ((Component)((Component)componentInParent).transform.GetChild(5).GetChild(5)).GetComponent<MenuSelectableElement>();
						}
						else
						{
							ActiveButton = ((Component)((Component)componentInParent).transform.GetChild(2).GetChild(4).GetChild(0)).GetComponent<MenuSelectableElement>();
						}
						break;
					}
					ActiveButtons[menuPage] = ActiveButton;
					clickCooldown = 0.25f;
					return;
				}
				float num = (((Object)(object)scrollableMenu != (Object)null) ? scrollableMenu.scrollerEndPosition : 0f);
				float num2 = (((Object)(object)scrollableMenu != (Object)null) ? ((Component)((Transform)scrollableMenu.scroller).parent).transform.position.y : 0f);
				GameObject currentGameObject = ((Component)ActiveButton).gameObject;
				Vector2 currentPos = Vector2.op_Implicit(currentGameObject.transform.position);
				Vector2 menuBoolShift = new Vector2(97f, 0f);
				Vector2 menuSliderShift = new Vector2(21f, 0f);
				MenuTwoOptions currentMenuBool = currentGameObject.GetComponentInParent<MenuTwoOptions>();
				MenuSlider currentMenuSlider = currentGameObject.GetComponentInParent<MenuSlider>();
				Component val = default(Component);
				currentGameObject.TryGetComponent(typeof(MenuButton), ref val);
				MenuButton val2 = (MenuButton)(object)((val is MenuButton) ? val : null);
				if ((Object)(object)currentMenuBool != (Object)null)
				{
					currentPos = ((direction.y != 0f) ? Vector2.op_Implicit(((Component)currentMenuBool).transform.position) : currentPos) - menuBoolShift;
				}
				else if ((Object)(object)currentMenuSlider != (Object)null)
				{
					currentPos = Vector2.op_Implicit(((Component)currentMenuSlider).transform.position) + (((Object)(object)val2 != (Object)null && ((TMP_Text)val2.buttonText).text == ">") ? menuSliderShift : Vector2.zero);
				}
				Vector2 localCurrentPos;
				if ((Object)(object)currentMenuBool != (Object)null)
				{
					localCurrentPos = Vector2.op_Implicit((direction.y != 0f) ? ((Component)currentMenuBool).transform.position : currentGameObject.transform.position) - currentPos - menuBoolShift;
				}
				else if ((Object)(object)currentMenuSlider != (Object)null)
				{
					localCurrentPos = Vector2.op_Implicit(((Component)currentMenuSlider).transform.position) - currentPos + (((Object)(object)val2 != (Object)null && ((TMP_Text)val2.buttonText).text == ">") ? menuSliderShift : Vector2.zero);
				}
				else
				{
					localCurrentPos = Vector2.op_Implicit(currentGameObject.transform.position) - currentPos;
				}
				var source = selectableElements.Select((MenuSelectableElement btn, int idx) => new
				{
					btn = btn,
					idx = idx,
					pos = ((Component)btn).transform.position
				}).Where(x =>
				{
					//IL_020d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0212: 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)
					//IL_0222: Unknown result type (might be due to invalid IL or missing references)
					//IL_0226: Unknown result type (might be due to invalid IL or missing references)
					//IL_022b: Unknown result type (might be due to invalid IL or missing references)
					//IL_026b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0270: Unknown result type (might be due to invalid IL or missing references)
					//IL_0237: Unknown result type (might be due to invalid IL or missing references)
					//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
					//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
					//IL_027c: Unknown result type (might be due to invalid IL or missing references)
					//IL_024e: 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_01c3: 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_01ce: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
					//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
					//IL_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_00d3: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
					//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
					//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
					//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
					//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
					//IL_0293: Unknown result type (might be due to invalid IL or missing references)
					//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
					//IL_0108: 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_0119: Unknown result type (might be due to invalid IL or missing references)
					//IL_011e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0123: Unknown result type (might be due to invalid IL or missing references)
					//IL_0300: Unknown result type (might be due to invalid IL or missing references)
					//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
					//IL_0340: Unknown result type (might be due to invalid IL or missing references)
					//IL_0347: Unknown result type (might be due to invalid IL or missing references)
					//IL_0200: Unknown result type (might be due to invalid IL or missing references)
					//IL_0205: Unknown result type (might be due to invalid IL or missing references)
					//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
					//IL_0314: 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_01a1: 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_01ac: Unknown result type (might be due to invalid IL or missing references)
					//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
					if (!((Behaviour)x.btn).isActiveAndEnabled)
					{
						return false;
					}
					Component val3 = default(Component);
					currentGameObject.TryGetComponent(typeof(MenuButton), ref val3);
					MenuButton val4 = (MenuButton)(object)((val3 is MenuButton) ? val3 : null);
					GameObject gameObject3 = ((Component)x.btn).gameObject;
					MenuTwoOptions componentInParent4 = gameObject3.GetComponentInParent<MenuTwoOptions>();
					MenuSlider componentInParent5 = gameObject3.GetComponentInParent<MenuSlider>();
					Vector2 val5;
					if ((Object)(object)componentInParent4 != (Object)null)
					{
						if (!((Object)(object)currentMenuBool != (Object)null) || !((Object)(object)componentInParent4 == (Object)(object)currentMenuBool))
						{
							MenuSelectableElement componentInParent6 = ((Component)componentInParent4.option2TextMesh).GetComponentInParent<MenuSelectableElement>();
							if ((Object)(object)x.btn == (Object)(object)componentInParent6)
							{
								return false;
							}
							val5 = Vector2.op_Implicit(((Component)componentInParent4).transform.position) - menuBoolShift - currentPos;
						}
						else
						{
							val5 = Vector2.op_Implicit((direction.y != 0f) ? ((Component)componentInParent4).transform.position : x.pos) - currentPos - menuBoolShift;
						}
					}
					else if ((Object)(object)componentInParent5 != (Object)null)
					{
						if (!((Object)(object)currentMenuSlider != (Object)null) || !((Object)(object)componentInParent5 == (Object)(object)currentMenuSlider))
						{
							if ((Object)(object)val4 != (Object)null && ((TMP_Text)val4.buttonText).text == ">")
							{
								return false;
							}
							val5 = Vector2.op_Implicit(((Component)componentInParent5).transform.position) - currentPos;
						}
						else
						{
							val5 = Vector2.op_Implicit(((Component)componentInParent5).transform.position) - currentPos + (((Object)(object)val4 != (Object)null && ((TMP_Text)val4.buttonText).text == ">") ? menuSliderShift : Vector2.zero);
						}
					}
					else
					{
						val5 = Vector2.op_Implicit(x.pos) - currentPos;
					}
					return (!(direction == Vector2.up) || (!(val5.y < localCurrentPos.y) && !Mathf.Approximately(val5.y, localCurrentPos.y))) && (!(direction == Vector2.down) || (!(val5.y > localCurrentPos.y) && !Mathf.Approximately(val5.y, localCurrentPos.y))) && (!(direction == Vector2.right) || (!(val5.x < localCurrentPos.x) && !Mathf.Approximately(val5.x, localCurrentPos.x))) && (!(direction == Vector2.left) || (!(val5.x > localCurrentPos.x) && !Mathf.Approximately(val5.x, localCurrentPos.x))) && Vector2.Dot(direction, ((Vector2)(ref val5)).normalized) > 0.75f && (Object)(object)x.btn != (Object)(object)ActiveButton;
				}).OrderBy(x =>
				{
					//IL_001c: 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_0059: Unknown result type (might be due to invalid IL or missing references)
					//IL_005e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0041: 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_0046: Unknown result type (might be due to invalid IL or missing references)
					GameObject gameObject2 = ((Component)x.btn).gameObject;
					MenuTwoOptions componentInParent2 = gameObject2.GetComponentInParent<MenuTwoOptions>();
					MenuSlider componentInParent3 = gameObject2.GetComponentInParent<MenuSlider>();
					return Vector2.Distance(currentPos, ((Object)(object)componentInParent2 != (Object)null) ? (Vector2.op_Implicit(x.pos) - menuBoolShift) : Vector2.op_Implicit(((Object)(object)componentInParent3 != (Object)null) ? ((Component)componentInParent3).transform.position : x.pos));
				})
					.ToList();
				var anon = source.FirstOrDefault(c => (Object)(object)c.btn != (Object)(object)ActiveButton);
				if (anon != null)
				{
					ActiveButton = anon.btn;
					SteamInput.Internal.Legacy_TriggerHapticPulse(controller.Handle, (SteamControllerPad)0, (ushort)20000);
					GameObject gameObject = ((Component)ActiveButton).gameObject;
					float num3 = 0f;
					if ((Object)(object)scrollableMenu != (Object)null && ((Behaviour)scrollableMenu).isActiveAndEnabled && gameObject.transform.IsChildOf(((Component)scrollableMenu).transform))
					{
						Rect rect;
						if (num <= gameObject.transform.position.y)
						{
							while (num <= gameObject.transform.position.y)
							{
								float scrollHandleTargetPosition = scrollableMenu.scrollHandleTargetPosition;
								rect = ActiveButton.rectTransform.rect;
								scrollableMenu.scrollHandleTargetPosition = scrollHandleTargetPosition + ((Rect)(ref rect)).height;
								scrollableMenu.Update();
								num3 += Time.deltaTime;
								if (num3 > 1f)
								{
									break;
								}
							}
						}
						else if (num2 >= gameObject.transform.position.y)
						{
							while (num2 >= gameObject.transform.position.y)
							{
								float scrollHandleTargetPosition2 = scrollableMenu.scrollHandleTargetPosition;
								rect = ActiveButton.rectTransform.rect;
								scrollableMenu.scrollHandleTargetPosition = scrollHandleTargetPosition2 - ((Rect)(ref rect)).height;
								scrollableMenu.Update();
								num3 += Time.deltaTime;
								if (num3 > 1f)
								{
									break;
								}
							}
						}
						scrollableMenu.Update();
					}
				}
				ActiveButtons[menuPage] = ActiveButton;
				clickCooldown = 0.25f;
			}

			[HarmonyPatch(typeof(MenuPageSettings), "ButtonEventControls")]
			[HarmonyPrefix]
			internal static bool ButtonEventControls()
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				if (!controllerActive)
				{
					return true;
				}
				SteamInput.Internal.ShowBindingPanel(controller.Handle);
				return false;
			}
		}

		private static class InputPatches
		{
			[HarmonyPatch(typeof(MenuCursor), "Update")]
			[HarmonyPrefix]
			internal static bool UpdateMenuCursor(MenuCursor __instance)
			{
				if (!controllerActive)
				{
					return true;
				}
				if (__instance.mesh.activeSelf)
				{
					__instance.mesh.gameObject.SetActive(false);
					Cursor.lockState = (CursorLockMode)1;
				}
				return false;
			}

			[HarmonyPatch(typeof(SteamInput), "InitializeInterface")]
			[HarmonyPostfix]
			internal static void InitializeInterfacePatch()
			{
				SteamInput.Internal.Init(false);
				MonoBehaviour.print((object)"SteamInput Initialized");
			}

			[HarmonyPatch(typeof(SteamManager), "Awake")]
			[HarmonyPostfix]
			private static void AwakePatch()
			{
				//IL_005e: 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_0196: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)InputStore.GlyphSpriteSheet == (Object)null))
				{
					return;
				}
				InputStore.GenerateAllGlyphs();
				string directoryName = Path.GetDirectoryName(Application.dataPath);
				string directoryName2 = Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location);
				string steamRootFromPath = SteamInputHandler.GetSteamRootFromPath(SteamInput.Internal.GetGlyphForActionOrigin_Legacy((InputActionOrigin)1));
				string sourceFileName = directoryName2 + "\\game_actions_3241660.vdf";
				SteamId steamId = SteamClient.SteamId;
				string destination = $"{steamRootFromPath}\\steamapps\\common\\Steam Controller Configs\\{((SteamId)(ref steamId)).AccountId}\\config\\3241660";
				if (!Directory.Exists(directoryName + "\\TouchMenuIcons"))
				{
					FileSystem.CopyDirectory(directoryName2 + "\\textures\\TouchMenuIcons", directoryName + "\\TouchMenuIcons");
				}
				if (!Directory.Exists(steamRootFromPath + "\\controller_config"))
				{
					Directory.CreateDirectory(steamRootFromPath + "\\controller_config");
				}
				string[] array;
				if (File.Exists(steamRootFromPath + "\\controller_config\\game_actions_3241660.vdf") && File.Exists(steamRootFromPath + "\\controller_config\\game_actions_3241660.version"))
				{
					array = File.ReadAllLines(steamRootFromPath + "\\controller_config\\game_actions_3241660.version");
					if (array == null || !(array[0] != ((BaseUnityPlugin)Instance).Info.Metadata.Version.ToString()))
					{
						goto IL_01ad;
					}
				}
				File.Copy(sourceFileName, steamRootFromPath + "\\controller_config\\game_actions_3241660.vdf", overwrite: true);
				array = new string[1] { ((BaseUnityPlugin)Instance).Info.Metadata.Version.ToString() };
				File.WriteAllLines(steamRootFromPath + "\\controller_config\\game_actions_3241660.version", array);
				MenuManager.instance.PagePopUpScheduled("Heads Up", Color.white, "Controller configs have just been\n(re-)registered with steam.\nYou may need to restart the Game and Steam for them to apply.", "Gotcha", true);
				goto IL_01ad;
				IL_01ad:
				FileSystem.CopyDirectory(directoryName2 + "\\InputConfigs", destination, overwrite: true);
			}

			[HarmonyPatch(typeof(InputManager), "Start")]
			[HarmonyPostfix]
			internal static void StartPatch(InputManager __instance)
			{
				InputStore.GenerateInputActions(__instance.inputActions);
			}

			[HarmonyPatch(typeof(MenuManager), "StateSet")]
			[HarmonyPostfix]
			[HarmonyPriority(0)]
			private static void MenuStateSet(MenuState state)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0004: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: 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_0022: 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_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Invalid comparison between Unknown and I4
				//IL_0080: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: Invalid comparison between Unknown and I4
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				if ((int)state != 0)
				{
					if ((int)state == 1)
					{
						SteamInput.Internal.ActivateActionSet(controller.Handle, (Object.op_Implicit((Object)(object)PlayerAvatar.instance) && PlayerAvatar.instance.spectating && (int)SpectateCamera.instance.currentState != 2) ? InputStore.ActionSetSpectatorControls : InputStore.ActionSetGameControls);
						ActionSetItemRotateLayerActive = false;
						ActionSetItemDistanceLayerActive = false;
						DebugPrint($"State closed: {((Controller)(ref controller)).Id} : {SteamInput.Internal.GetCurrentActionSet(controller.Handle)}");
					}
				}
				else
				{
					SteamInput.Internal.ActivateActionSet(controller.Handle, InputStore.ActionSetMenuControls);
					ActionSetItemRotateLayerActive = false;
					ActionSetItemDistanceLayerActive = false;
					DebugPrint($"State opened: {((Controller)(ref controller)).Id} : {SteamInput.Internal.GetCurrentActionSet(controller.Handle)}");
				}
			}

			[HarmonyPatch(typeof(PlayerAvatar), "SetSpectate")]
			[HarmonyPostfix]
			internal static void SetSpectate(PlayerAvatar __instance)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				SteamInput.Internal.ActivateActionSet(controller.Handle, InputStore.ActionSetSpectatorControls);
				DebugPrint($"ActionSet(SetSpectate): {SteamInput.Internal.GetCurrentActionSet(controller.Handle)}");
			}

			[HarmonyPatch(typeof(SpectateCamera), "StopSpectate")]
			[HarmonyPostfix]
			internal static void StopSpectate(SpectateCamera __instance)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				SteamInput.Internal.ActivateActionSet(controller.Handle, InputStore.ActionSetGameControls);
				DebugPrint($"ActionSet(StopSpectate): {SteamInput.Internal.GetCurrentActionSet(controller.Handle)}");
			}

			[HarmonyPatch(typeof(ChatManager), "StateActive")]
			[HarmonyPostfix]
			internal static void ChatStateActive()
			{
				//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_0022: 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_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_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				if (MenuManager.instance.currentMenuState != 1)
				{
					InputActionSetHandle_t currentActionSet = SteamInput.Internal.GetCurrentActionSet(controller.Handle);
					if (!((InputActionSetHandle_t)(ref currentActionSet)).Equals(InputStore.ActionSetMenuControls))
					{
						return;
					}
				}
				SteamInput.Internal.ActivateActionSet(controller.Handle, InputStore.ActionSetMenuControls);
				DebugPrint($"ActionSet(ChatStateActive): {SteamInput.Internal.GetCurrentActionSet(controller.Handle)}");
				ActionSetItemRotateLayerActive = false;
				ActionSetItemDistanceLayerActive = false;
			}

			[HarmonyPatch(typeof(ChatManager), "StateInactive")]
			[HarmonyPostfix]
			internal static void ChatStateInactive()
			{
				//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)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Invalid comparison between Unknown and I4
				//IL_0056: 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_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_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bd: 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_00e6: 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_00e4: Invalid comparison between Unknown and I4
				//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_0116: Unknown result type (might be due to invalid IL or missing references)
				//IL_011c: Invalid comparison between Unknown and I4
				if (Object.op_Implicit((Object)(object)MenuManager.instance.currentMenuPage) || MenuManager.instance.currentMenuState != 1)
				{
					return;
				}
				InputActionSetHandle_t currentActionSet = SteamInput.Internal.GetCurrentActionSet(controller.Handle);
				if (((InputActionSetHandle_t)(ref currentActionSet)).Equals((PlayerAvatar.instance.spectating && (int)SpectateCamera.instance.currentState != 2) ? InputStore.ActionSetSpectatorControls : InputStore.ActionSetGameControls))
				{
					return;
				}
				if (!PlayerAvatar.instance.spectating || (PlayerAvatar.instance.spectating && InputStore.InputDown[InputStore.ActionInteract.DigitalActionHandle] == ButtonState.Released))
				{
					InputActionSetHandle_t currentActionSet2 = SteamInput.Internal.GetCurrentActionSet(controller.Handle);
					SteamInput.Internal.ActivateActionSet(controller.Handle, (PlayerAvatar.instance.spectating && (int)SpectateCamera.instance.currentState != 2) ? InputStore.ActionSetSpectatorControls : InputStore.ActionSetGameControls);
					if (currentActionSet2 == InputStore.ActionSetSpectatorControls && PlayerAvatar.instance.spectating && (int)SpectateCamera.instance.currentState == 2)
					{
						((TMP_Text)SpectateHeadUI.instance.promptText).text = InputManager.instance.InputDisplayReplaceTags("<color=#FF8C00>Press</color> [interact]", "<color=white>", "</color>");
					}
				}
				DebugPrint($"ActionSet(ChatStateInactive): {SteamInput.Internal.GetCurrentActionSet(controller.Handle)}");
				ActionSetItemRotateLayerActive = false;
				ActionSetItemDistanceLayerActive = false;
			}

			[HarmonyPatch(typeof(MenuManager), "PageOpen")]
			[HarmonyPostfix]
			[HarmonyPriority(0)]
			internal static void MenuPageOpen()
			{
				((ConfigEntryBase)GrabToggle).ConfigFile.Reload();
			}

			[HarmonyPatch(typeof(MenuManager), "PageSetCurrent")]
			[HarmonyPostfix]
			[HarmonyPriority(0)]
			internal static void MenuPageSetCurrent()
			{
				((ConfigEntryBase)GrabToggle).ConfigFile.Reload();
			}

			[HarmonyPatch(typeof(InputManager), "InputToggleGet")]
			[HarmonyPrefix]
			internal static bool InputToggleGet_Prefix(ref bool __result, InputKey key)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Invalid comparison between Unknown and I4
				__result = !controllerActive || ((int)key == 10 && GrabToggle.Value);
				return !controllerActive;
			}

			[HarmonyPatch(typeof(InputManager), "KeyDown")]
			[HarmonyPrefix]
			internal static bool KeyDown_Prefix(InputManager __instance, ref bool __result, InputKey key)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Invalid comparison between Unknown and I4
				//IL_0009: 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_0066: Expected I4, but got Unknown
				//IL_0097: 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)
				if (key - 1 > 1)
				{
					switch (key - 12)
					{
					case 0:
					case 2:
					case 7:
					case 8:
					case 9:
					case 14:
					case 15:
					case 16:
					case 17:
					case 18:
					case 19:
					case 20:
						break;
					default:
						goto IL_006c;
					}
				}
				bool flag = true;
				goto IL_006e;
				IL_006e:
				if (flag && __instance.disableMovementTimer > 0f)
				{
					__result = false;
					return false;
				}
				if (InputStore.InputDown[InputStore.InputNameForSteam[key].DigitalActionHandle] != ButtonState.Pressed)
				{
					return true;
				}
				__result = true;
				return false;
				IL_006c:
				flag = false;
				goto IL_006e;
			}

			[HarmonyPatch(typeof(InputManager), "KeyUp")]
			[HarmonyPrefix]
			internal static bool KeyUp_Prefix(InputManager __instance, ref bool __result, InputKey key)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: Invalid comparison between Unknown and I4
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Invalid comparison between Unknown and I4
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Invalid comparison between Unknown and I4
				//IL_0044: 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)
				bool flag = (((int)key == 1 || (int)key == 12 || (int)key == 14) ? true : false);
				if (flag && __instance.disableMovementTimer > 0f)
				{
					__result = false;
					return false;
				}
				if (InputStore.InputDown[InputStore.InputNameForSteam[key].DigitalActionHandle] != ButtonState.Released)
				{
					return true;
				}
				__result = true;
				return false;
			}

			[HarmonyPatch(typeof(InputManager), "KeyPullAndPush")]
			[HarmonyPrefix]
			internal static bool KeyPullAndPush_Prefix(InputManager __instance, ref float __result)
			{
				//IL_0011: 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_006c: 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_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_0096: Unknown result type (might be due to invalid IL or missing references)
				SteamInput.RunFrame();
				if (SteamInput.Internal.GetAnalogActionData(controller.Handle, InputStore.AnalogActionItemDistance.AnalogActionHandle).Y != 0f)
				{
					__result = SteamInput.Internal.GetAnalogActionData(controller.Handle, InputStore.AnalogActionItemDistance.AnalogActionHandle).Y;
					return false;
				}
				if (InputStore.InputDown[InputStore.ActionPush.DigitalActionHandle] >= ButtonState.Pressed)
				{
					__result = 1f;
					return false;
				}
				if (InputStore.InputDown[InputStore.ActionPull.DigitalActionHandle] >= ButtonState.Pressed)
				{
					__result = -1f;
					return false;
				}
				return true;
			}

			[HarmonyPatch(typeof(InputManager), "KeyHold")]
			[HarmonyPrefix]
			internal static bool KeyHold_Prefix(InputManager __instance, ref bool __result, InputKey key)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0004: Invalid comparison between Unknown and I4
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Invalid comparison between Unknown and I4
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Invalid comparison between Unknown and I4
				//IL_001a: 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_001f: Invalid comparison between Unknown and I4
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Invalid comparison between Unknown and I4
				//IL_0052: 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)
				if ((int)key <= 12)
				{
					if ((int)key == 1 || (int)key == 12)
					{
						goto IL_0023;
					}
				}
				else if ((int)key == 14 || key - 26 <= 5)
				{
					goto IL_0023;
				}
				bool flag = false;
				goto IL_0029;
				IL_0029:
				if (flag && __instance.disableMovementTimer > 0f)
				{
					__result = false;
					return false;
				}
				if (InputStore.InputDown[InputStore.InputNameForSteam[key].DigitalActionHandle] <= ButtonState.Released)
				{
					return true;
				}
				__result = true;
				return false;
				IL_0023:
				flag = true;
				goto IL_0029;
			}

			[HarmonyPatch(typeof(InputManager), "GetMovementX")]
			[HarmonyPrefix]
			internal static bool GetMovementX_Prefix(InputManager __instance, ref float __result)
			{
				//IL_002e: 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_0061: 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)
				if (__instance.disableMovementTimer > 0f)
				{
					__result = 0f;
					return false;
				}
				SteamInput.RunFrame();
				if (SteamInput.Internal.GetAnalogActionData(controller.Handle, InputStore.AnalogActionMove.AnalogActionHandle).X == 0f)
				{
					return true;
				}
				__result = SteamInput.Internal.GetAnalogActionData(controller.Handle, InputStore.AnalogActionMove.AnalogActionHandle).X;
				return false;
			}

			[HarmonyPatch(typeof(InputManager), "GetMovementY")]
			[HarmonyPrefix]
			internal static bool GetMovementY_Prefix(InputManager __instance, ref float __result)
			{
				//IL_002e: 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_0061: 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)
				if (__instance.disableMovementTimer > 0f)
				{
					__result = 0f;
					return false;
				}
				SteamInput.RunFrame();
				if (SteamInput.Internal.GetAnalogActionData(controller.Handle, InputStore.AnalogActionMove.AnalogActionHandle).Y == 0f)
				{
					return true;
				}
				__result = SteamInput.Internal.GetAnalogActionData(controller.Handle, InputStore.AnalogActionMove.AnalogActionHandle).Y;
				return false;
			}

			[HarmonyPatch(typeof(InputManager), "GetScrollY")]
			[HarmonyPrefix]
			internal static bool GetScrollY_Prefix(InputManager __instance, ref float __result)
			{
				//IL_0011: 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_0072: 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_0044: 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_00a5: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
				SteamInput.RunFrame();
				if (SteamInput.Internal.GetAnalogActionData(controller.Handle, InputStore.AnalogActionZoom.AnalogActionHandle).Y != 0f)
				{
					__result = SteamInput.Internal.GetAnalogActionData(controller.Handle, InputStore.AnalogActionZoom.AnalogActionHandle).Y * 10f;
					return false;
				}
				if (SteamInput.Internal.GetAnalogActionData(controller.Handle, InputStore.AnalogActionMenuScroll.AnalogActionHandle).Y != 0f)
				{
					__result = SteamInput.Internal.GetAnalogActionData(controller.Handle, InputStore.AnalogActionMenuScroll.AnalogActionHandle).Y * 10f;
					return false;
				}
				return true;
			}

			[HarmonyPatch(typeof(InputManager), "GetMovement")]
			[HarmonyPrefix]
			internal static bool GetMovement_Prefix(InputManager __instance, ref Vector2 __result)
			{
				//IL_0034: 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_0057: 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_0075: 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_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_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				if (__instance.disableMovementTimer > 0f)
				{
					__result = Vector2.zero;
					return false;
				}
				SteamInput.RunFrame();
				Vector2 val = default(Vector2);
				((Vector2)(ref val))..ctor(SteamInput.Internal.GetAnalogActionData(controller.Handle, InputStore.AnalogActionMove.AnalogActionHandle).X, SteamInput.Internal.GetAnalogActionData(controller.Handle, InputStore.AnalogActionMove.AnalogActionHandle).Y);
				if (val == Vector2.zero)
				{
					return true;
				}
				__result = val;
				return false;
			}

			[HarmonyPatch(typeof(InputManager), "GetMouseX")]
			[HarmonyPrefix]
			internal static bool GetMouseX_Prefix(InputManager __instance, ref float __result)
			{
				if (__instance.disableAimingTimer > 0f)
				{
					__result = 0f;
					return false;
				}
				SteamInput.RunFrame();
				if (stickCameraState.X == 0f)
				{
					return true;
				}
				__result = stickCameraState.X * 0.1f;
				return false;
			}

			[HarmonyPatch(typeof(InputManager), "GetMouseY")]
			[HarmonyPrefix]
			internal static bool GetMouseY_Prefix(InputManager __instance, ref float __result)
			{
				if (__instance.disableAimingTimer > 0f)
				{
					__result = 0f;
					return false;
				}
				SteamInput.RunFrame();
				if (stickCameraState.Y == 0f)
				{
					return true;
				}
				__result = (0f - stickCameraState.Y) * 0.1f;
				return false;
			}

			[HarmonyPatch(typeof(PhysGrabber), "Update")]
			[HarmonyTranspiler]
			private static IEnumerable<CodeInstruction> PhysGrabberUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il)
			{
				//IL_0014: 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_0047: Expected O, but got Unknown
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Expected O, but got Unknown
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_0099: Expected O, but got Unknown
				//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Expected O, but got Unknown
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e0: Expected O, but got Unknown
				//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0103: Expected O, but got Unknown
				//IL_014c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0152: Expected O, but got Unknown
				//IL_016f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0175: Expected O, but got Unknown
				LocalBuilder localBuilder = il.DeclareLocal(typeof(float));
				return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[2]
				{
					new CodeMatch((OpCode?)OpCodes.Ldsfld, (object)AccessTools.Field(typeof(InputManager), "instance"), (string)null),
					new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(InputManager), "KeyPullAndPush", (Type[])null, (Type[])null), (string)null)
				}).Advance(2).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2]
				{
					new CodeInstruction(OpCodes.Stloc, (object)localBuilder.LocalIndex),
					new CodeInstruction(OpCodes.Ldloc, (object)localBuilder.LocalIndex)
				})
					.Advance(21)
					.RemoveInstruction()
					.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2]
					{
						new CodeInstruction(OpCodes.Ldloc, (object)localBuilder.LocalIndex),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(REPO_SteamInput), "PushAndPull", (Type[])null, (Type[])null))
					})
					.Advance(3)
					.SetAndAdvance(OpCodes.Ldloc, (object)localBuilder.LocalIndex)
					.RemoveInstruction()
					.Advance(21)
					.RemoveInstruction()
					.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2]
					{
						new CodeInstruction(OpCodes.Ldloc, (object)localBuilder.LocalIndex),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(REPO_SteamInput), "PushAndPull", (Type[])null, (Type[])null))
					})
					.InstructionEnumeration();
			}

			[HarmonyPatch(typeof(PhysGrabber), "ObjectTurning")]
			[HarmonyTranspiler]
			private static IEnumerable<CodeInstruction> ObjectTurningPatches(IEnumerable<CodeInstruction> instructions)
			{
				//IL_0003: 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: Expected O, but got Unknown
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Expected O, but got Unknown
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Expected O, but got Unknown
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Expected O, but got Unknown
				return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"Mouse X", (string)null)
				}).RemoveInstructions(10).Insert((CodeInstruction[])(object)new CodeInstruction[3]
				{
					new CodeInstruction(OpCodes.Ldloca_S, (object)(byte)5),
					new CodeInstruction(OpCodes.Ldloca_S, (object)(byte)6),
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(InputPatches), "GetRotationInput", (Type[])null, (Type[])null))
				})
					.InstructionEnumeration();
			}

			private static void GetRotationInput(ref float x, ref float y)
			{
				float num = Mathf.Lerp(0.2f, 2.5f, GameplayManager.instance.aimSensitivity / 100f);
				x = stickRotateState.X * 0.1f + Input.GetAxis("Mouse X") * num;
				y = (0f - stickRotateState.Y) * 0.1f + Input.GetAxis("Mouse Y") * num;
			}

			[HarmonyPatch(typeof(PhysGrabber), "FixedUpdate")]
			[HarmonyTranspiler]
			private static IEnumerable<CodeInstruction> FixedUpdatePatches(IEnumerable<CodeInstruction> instructions)
			{
				//IL_0003: 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_0038: Expected O, but got Unknown
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Expected O, but got Unknown
				return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(SemiFunc), "CameraOverrideStopAim", (Type[])null, (Type[])null), (string)null)
				}).RemoveInstruction().Insert((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(InputPatches), "ShouldOverrideCamera", (Type[])null, (Type[])null))
				})
					.InstructionEnumeration();
			}

			private static void ShouldOverrideCamera()
			{
				if (!controllerActive)
				{
					SemiFunc.CameraOverrideStopAim();
				}
			}

			[HarmonyPatch(typeof(SplashScreen), "SkipLogic")]
			[HarmonyPrefix]
			internal static bool SkipLogic_Prefix(SplashScreen __instance)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Invalid comparison between Unknown and I4
				if ((int)__instance.state > 0 && DataDirector.instance.SettingValueFetch((Setting)58) != 0 && ControllerAnyInput(ignoreAnalog: true))
				{
					__instance.StateSet((State)3);
					return false;
				}
				return true;
			}

			[HarmonyPatch(typeof(CameraShake), "Update")]
			[HarmonyPostfix]
			internal static void CameraShake_Postfix(CameraShake __instance)
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				if (__instance.Strength > 4f)
				{
					controllerRumbleTime = 0.25f;
					SteamInput.Internal.TriggerVibration(controller.Handle, (ushort)(10000f * __instance.Strength - 4f), (ushort)(10000f * __instance.Strength - 4f));
				}
			}

			[HarmonyPatch(typeof(PhysGrabObjectImpactDetector), "ImpactHeavyRPC")]
			[HarmonyPostfix]
			internal static void ImpactHeavy(PhysGrabObjectImpactDetector __instance)
			{
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				if (__instance.physGrabObject.heldByLocalPlayer)
				{
					controllerRumbleTime = 1f;
					SteamInput.Internal.TriggerVibration(controller.Handle, ushort.MaxValue, ushort.MaxValue);
				}
			}

			[HarmonyPatch(typeof(PhysGrabObjectImpactDetector), "ImpactMediumRPC")]
			[HarmonyPostfix]
			internal static void ImpactMedium(PhysGrabObjectImpactDetector __instance)
			{
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				if (__instance.physGrabObject.heldByLocalPlayer)
				{
					controllerRumbleTime = 0.5f;
					SteamInput.Internal.TriggerVibration(controller.Handle, (ushort)32767, (ushort)32767);
				}
			}

			[HarmonyPatch(typeof(PhysGrabObjectImpactDetector), "ImpactLightRPC")]
			[HarmonyPostfix]
			internal static void ImpactLight(PhysGrabObjectImpactDetector __instance)
			{
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				if (__instance.physGrabObject.heldByLocalPlayer)
				{
					controllerRumbleTime = 0.25f;
					SteamInput.Internal.TriggerVibration(controller.Handle, (ushort)21845, (ushort)21845);
				}
			}

			[HarmonyPatch(typeof(InputManager), "InputDisplayGet")]
			[HarmonyPrefix]
			private static bool InputDisplayGet(InputManager __instance, InputKey _inputKey, ref string __result)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				if (!controllerActive)
				{
					return true;
				}
				InputAction action = __instance.GetAction(_inputKey);
				if (action == null)
				{
					__result = "missing";
					return false;
				}
				__result = __instance.InputDisplayGetString(action, 0);
				return false;
			}

			[HarmonyPatch(typeof(InputManager), "InputDisplayGetString")]
			[HarmonyPrefix]
			private static bool InputDisplayGetString(InputAction action, ref string __result)
			{
				//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_005e: 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_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_0222: Unknown result type (might be due to invalid IL or missing references)
				//IL_0227: Unknown result type (might be due to invalid IL or missing references)
				//IL_0229: Unknown result type (might be due to invalid IL or missing references)
				//IL_022d: 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_024c: 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_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_027e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0285: Unknown result type (might be due to invalid IL or missing references)
				//IL_0291: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0102: Unknown result type (might be due to invalid IL or missing references)
				//IL_0106: 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_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_013c: 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_0181: Unknown result type (might be due to invalid IL or missing references)
				//IL_019e: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
				SteamInput.RunFrame();
				if (!controllerActive)
				{
					return true;
				}
				ActionHandle key = InputStore.InputActionForSteam[action];
				string text = "";
				if (key.IsDigitalAction)
				{
					InputActionSetHandle_t[] array = InputStore.InputForActionSet[key];
					InputActionSetHandle_t val = array[0];
					InputActionSetHandle_t currentActionSet = SteamInput.Internal.GetCurrentActionSet(controller.Handle);
					if (val != currentActionSet && array.Contains(currentActionSet))
					{
						val = currentActionSet;
					}
					string text2 = SteamInputHandler.GetDigitalGlyphs(val, key.DigitalActionHandle);
					if (text2 == "button_none" && InputStore.AnalogDigitalActions.TryGetValue(key.DigitalActionHandle, out var value))
					{
						text2 = SteamInputHandler.GetAnalogGlyphs(val, value);
					}
					if (text2 == "button_none" && InputStore.ActionLayersForInput.TryGetValue(key.DigitalActionHandle, out var value2))
					{
						string digitalGlyphs = SteamInputHandler.GetDigitalGlyphs(val, value2.Item2);
						text2 = SteamInputHandler.GetDigitalGlyphs(value2.Item1, key.DigitalActionHandle);
						if (text2 == "button_none" && InputStore.RelatedInputsForActionLayer.TryGetValue(value2.Item1, out ActionHandle[] value3))
						{
							ActionHandle[] array2 = value3;
							for (int i = 0; i < array2.Length; i++)
							{
								ActionHandle actionHandle = array2[i];
								if (actionHandle.IsAnalogAction)
								{
									text2 = SteamInputHandler.GetAnalogGlyphs(value2.Item1, actionHandle.AnalogActionHandle);
								}
								else if (actionHandle.IsDigitalAction)
								{
									text2 = SteamInputHandler.GetDigitalGlyphs(value2.Item1, actionHandle.DigitalActionHandle);
								}
								if (text2 != "button_none")
								{
									break;
								}
							}
						}
						text = "<sprite name=" + digitalGlyphs + "> + ";
					}
					text = text + "<sprite name=" + text2 + ">";
				}
				else if (key.IsAnalogAction)
				{
					InputActionSetHandle_t[] array3 = InputStore.InputForActionSet[key];
					InputActionSetHandle_t val2 = array3[0];
					string analogGlyphs = SteamInputHandler.GetAnalogGlyphs(val2, key.AnalogActionHandle);
					if (analogGlyphs == "button_none" && InputStore.ActionLayersForSets.TryGetValue(val2, out (InputActionSetHandle_t, InputDigitalActionHandle_t)[] value4))
					{
						string text3 = "button_none";
						(InputActionSetHandle_t, InputDigitalActionHandle_t)[] array4 = value4;
						for (int j = 0; j < array4.Length; j++)
						{
							(InputActionSetHandle_t, InputDigitalActionHandle_t) tuple = array4[j];
							analogGlyphs = SteamInputHandler.GetAnalogGlyphs(tuple.Item1, key.AnalogActionHandle);
							text3 = SteamInputHandler.GetDigitalGlyphs(val2, tuple.Item2);
						}
						text = "<sprite name=" + text3 + "> + ";
					}
					text = text + "<sprite name=" + analogGlyphs + ">";
				}
				__result = text;
				return false;
			}

			[HarmonyPatch(typeof(InputManager), "InputDisplayReplaceTags")]
			[HarmonyPrefix]
			private static bool NoUnderlinePatch(InputManager __instance, ref string __result, ref string _text)
			{
				InputManager __instance2 = __instance;
				if (!controllerActive)
				{
					return true;
				}
				_text = __instance2.tagDictionary.Aggregate(_text, (string current, KeyValuePair<string, InputKey> keyValuePair) => current.Replace(keyValuePair.Key, __instance2.InputDisplayGet(keyValuePair.Value, (KeyType)0, (MovementDirection)0)));
				__result = _text;
				return false;
			}

			[HarmonyPatch(typeof(ItemInfoUI), "ItemInfoText")]
			[HarmonyPrefix]
			private static void ItemInfoTextPrefix(ItemInfoUI __instance)
			{
				if (controllerActive)
				{
					((TMP_Text)__instance.Text).spriteAsset = InputStore.GlyphSpriteSheet;
				}
				else
				{
					((TMP_Text)__instance.Text).spriteAsset = ItemInfoOriginalEmojis;
				}
			}

			[HarmonyPatch(typeof(ItemInfoUI), "Start")]
			[HarmonyPostfix]
			private static void ItemInfoUI_Postfix(ItemInfoUI __instance)
			{
				ItemInfoOriginalEmojis = ((TMP_Text)__instance.Text).spriteAsset;
			}

			[HarmonyPatch(typeof(SpectateHeadUI), "Update")]
			[HarmonyPrefix]
			private static void SpectateHeadUI_Update(SpectateHeadUI __instance)
			{
				if (controllerActive)
				{
					((TMP_Text)__instance.promptText).spriteAsset = InputStore.GlyphSpriteSheet;
				}
				else
				{
					((TMP_Text)__instance.promptText).spriteAsset = OriginalEmojis;
				}
			}

			[HarmonyPatch(typeof(SpectateHeadUI), "Start")]
			[HarmonyPostfix]
			private static void SpectateHeadUI_Postfix(SpectateHeadUI __instance)
			{
				OriginalEmojis = ((TMP_Text)__instance.promptText).spriteAsset;
			}

			[HarmonyPatch(typeof(MenuPageLobby), "UpdateChatPrompt")]
			[HarmonyPrefix]
			private static void MenuPageLobby_UpdateChatPrompt(MenuPageLobby __instance)
			{
				if (controllerActive)
				{
					((TMP_Text)__instance.chatPromptText).spriteAsset = InputStore.GlyphSpriteSheet;
				}
				else
				{
					((TMP_Text)__instance.chatPromptText).spriteAsset = OriginalEmojis;
				}
			}

			[HarmonyPatch(typeof(MenuPageLobby), "Start")]
			[HarmonyPostfix]
			private static void MenuPageLobby_Postfix(MenuPageLobby __instance)
			{
				OriginalEmojis = ((TMP_Text)__instance.chatPromptText).spriteAsset;
			}

			[HarmonyPatch(typeof(TutorialUI), "Start")]
			[HarmonyPostfix]
			private static void OnTutorialStart(TutorialUI __instance)
			{
				TutorialOriginalEmojis = ((TMP_Text)__instance.Text).spriteAsset;
				if (controllerActive)
				{
					((TMP_Text)__instance.dummyText).spriteAsset = InputStore.GlyphSpriteSheet;
					((TMP_Text)__instance.Text).spriteAsset = InputStore.GlyphSpriteSheet;
				}
			}

			[HarmonyPatch(typeof(TutorialUI), "SetPage")]
			[HarmonyPrefix]
			private static void UpdateTextSpriteAtlas(TutorialUI __instance, ref string dummyTextString, bool transition)
			{
				if (!controllerActive)
				{
					((TMP_Text)__instance.Text).spriteAsset = TutorialOriginalEmojis;
					return;
				}
				((TMP_Text)__instance.Text).spriteAsset = (transition ? TutorialOriginalEmojis : InputStore.GlyphSpriteSheet);
				dummyTextString = dummyTextString.Replace("keyboard", "controller");
			}

			[HarmonyPatch(typeof(TutorialUI), "SetTipPage")]
			[HarmonyPrefix]
			private static void UpdateTipTextSpriteAtlas(TutorialUI __instance, ref string text)
			{
				if (controllerActive)
				{
					((TMP_Text)__instance.Text).spriteAsset = InputStore.GlyphSpriteSheet;
					text = text.Replace("keyboard", "controller");
				}
			}

			[HarmonyPatch(/*Could not decode attribute arguments.*/)]
			[HarmonyTranspiler]
			private static IEnumerable<CodeInstruction> SwitchPagePatch(IEnumerable<CodeInstruction> instructions)
			{
				//IL_0003: 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: Expected O, but got Unknown
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Expected O, but got Unknown
				//IL_0076: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Expected O, but got Unknown
				return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.PropertySetter(typeof(TMP_Text), "text"), (string)null)
				}).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2]
				{
					new CodeInstruction(OpCodes.Ldloc_1, (object)null),
					new CodeInstruction(OpCodes.Call, (object)new Action<TutorialUI>(SetSpriteAtlas).Method)
				}).InstructionEnumeration();
				static void SetSpriteAtlas(TutorialUI ui)
				{
					if (controllerActive)
					{
						((TMP_Text)ui.Text).spriteAsset = InputStore.GlyphSpriteSheet;
					}
				}
			}

			[HarmonyPatch(typeof(TutorialDirector), "EndTutorial")]
			[HarmonyPrefix]
			private static void EndTutorial(TutorialDirector __instance)
			{
				TutorialOriginalEmojis = null;
			}
		}

		private const bool DEBUG = false;

		private static readonly Thread GlyphCheck = new Thread(CheckForGlyphChange);

		private static TMP_SpriteAsset TutorialOriginalEmojis = null;

		private static TMP_SpriteAsset ItemInfoOriginalEmojis = null;

		private static TMP_SpriteAsset OriginalEmojis = null;

		public static bool ActionSetItemDistanceLayerActive;

		public static bool ActionSetItemRotateLayerActive;

		public static bool ShowedKeyboard;

		internal static Controller controller;

		internal static bool controllerActive;

		internal static float controllerRumbleTime;

		internal static float clickCooldown;

		internal static Dictionary<MenuPage, MenuSelectableElement> ActiveButtons = new Dictionary<MenuPage, MenuSelectableElement>();

		internal static bool openedOnTop;

		internal static AnalogState stickCameraState;

		internal static AnalogState stickRotateState;

		public static ConfigEntry<bool> GrabToggle = null;

		internal static REPO_SteamInput Instance { get; private set; } = null;


		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			GlyphCheck.IsBackground = true;
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			GrabToggle = ((BaseUnityPlugin)this).Config.Bind<bool>("Controls", "Grab Toggle", false, new ConfigDescription("Lets the game handle grab toggles instead of SteamInput. (No more randomly grabbing something.)", (AcceptableValueBase)null, Array.Empty<object>()));
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		private void Update()
		{
			//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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			//IL_0029: 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_007a: 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_00ea: 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_0114: 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_0112: Invalid comparison between Unknown and I4
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: 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)