Decompiled source of GamepadUISwitcher v1.2.1

GamepadUISwitcher.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GamepadUISwitcher;
using GlobalEnums;
using HarmonyLib;
using InControl;
using Microsoft.CodeAnalysis;
using TeamCherry.Localization;
using UI;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("GamepadUISwitcher")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1+30568967727a9f92357c8b0d3902a18057a6947a")]
[assembly: AssemblyProduct("GamepadUISwitcher")]
[assembly: AssemblyTitle("GamepadUISwitcher")]
[assembly: NeutralResourcesLanguage("EN")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.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;
		}
	}
}
public static class MenuResources
{
	public static Font TrajanProRegular { get; private set; }

	public static Font TrajanProBold { get; private set; }

	public static Font Perpetua { get; private set; }

	public static Font NotoSerifCJKSCRegular { get; private set; }

	public static RuntimeAnimatorController MenuTopFleurAnimator { get; private set; }

	public static RuntimeAnimatorController MenuCursorAnimator { get; private set; }

	public static RuntimeAnimatorController MenuButtonFlashAnimator { get; private set; }

	public static AnimatorOverrideController TextHideShowAnimator { get; private set; }

	public static Sprite ScrollbarHandleSprite { get; private set; }

	public static Sprite ScrollbarBackgroundSprite { get; private set; }

	static MenuResources()
	{
		ReloadResources();
	}

	public static void ReloadResources()
	{
		RuntimeAnimatorController[] array = Resources.FindObjectsOfTypeAll<RuntimeAnimatorController>();
		foreach (RuntimeAnimatorController val in array)
		{
			if ((Object)(object)val != (Object)null)
			{
				switch (((Object)val).name)
				{
				case "Menu Animate In Out":
					MenuTopFleurAnimator = val;
					break;
				case "Menu Fleur":
					MenuCursorAnimator = val;
					break;
				case "Menu Flash Effect":
					MenuButtonFlashAnimator = val;
					break;
				}
			}
		}
		AnimatorOverrideController[] array2 = Resources.FindObjectsOfTypeAll<AnimatorOverrideController>();
		foreach (AnimatorOverrideController val2 in array2)
		{
			if ((Object)(object)val2 != (Object)null)
			{
				AnimatorOverrideController textHideShowAnimator = (AnimatorOverrideController)((!(((Object)val2).name == "TextHideShow")) ? ((object)TextHideShowAnimator) : ((object)val2));
				TextHideShowAnimator = textHideShowAnimator;
			}
		}
		Font[] array3 = Resources.FindObjectsOfTypeAll<Font>();
		foreach (Font val3 in array3)
		{
			if ((Object)(object)val3 != (Object)null)
			{
				switch (((Object)val3).name)
				{
				case "TrajanPro-Regular":
					TrajanProRegular = val3;
					break;
				case "TrajanPro-Bold":
					TrajanProBold = val3;
					break;
				case "Perpetua":
					Perpetua = val3;
					break;
				case "NotoSerifCJKsc-Regular":
					NotoSerifCJKSCRegular = val3;
					break;
				}
			}
		}
		Sprite[] array4 = Resources.FindObjectsOfTypeAll<Sprite>();
		foreach (Sprite val4 in array4)
		{
			if (!((Object)(object)val4 != (Object)null))
			{
				continue;
			}
			string name = ((Object)val4).name;
			if (!(name == "scrollbar_fleur_new"))
			{
				if (name == "scrollbar_single")
				{
					ScrollbarBackgroundSprite = val4;
				}
			}
			else
			{
				ScrollbarHandleSprite = val4;
			}
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace UI
{
	public class BepinexMenuOptionHorizontal : MenuSelectable, IMoveHandler, IEventSystemHandler, IPointerClickHandler, ISubmitHandler
	{
		public enum ApplyOnType
		{
			Scroll,
			Submit
		}

		public Text optionText;

		public List<object> optionList;

		public string sheetTitle;

		public ConfigEntryBase configEntry;

		public ApplyOnType applySettingOn;

		public CanvasGroup? applyButton;

		public int selectedOptionIndex;

		private bool hasApplyButton;

		private int currentActiveIndex;

		private Delegate del;

		private bool justUpdatedEntry;

		private void OnConfigEntryUpdate(object obj, EventArgs evArgs)
		{
			if (justUpdatedEntry)
			{
				justUpdatedEntry = false;
			}
			else
			{
				RefreshCurrentIndex();
			}
		}

		private void Awake()
		{
			hasApplyButton = (Object)(object)applyButton != (Object)null;
		}

		private void OnEnable()
		{
			if (configEntry != null)
			{
				EventInfo? @event = ((object)configEntry).GetType().GetEvent("SettingChanged");
				del = Delegate.CreateDelegate(typeof(EventHandler), this, "OnConfigEntryUpdate");
				@event.AddEventHandler(configEntry, del);
			}
			GameManager.instance.RefreshLanguageText += UpdateText;
			RefreshMenuControls();
			UpdateApplyButton();
		}

		private void OnDisable()
		{
			if ((Object)(object)GameManager.instance != (Object)null)
			{
				GameManager.instance.RefreshLanguageText -= UpdateText;
			}
			if (configEntry != null)
			{
				((object)configEntry).GetType().GetEvent("SettingChanged").RemoveEventHandler(configEntry, del);
			}
		}

		public void OnMove(AxisEventData move)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (((Selectable)this).interactable && !MoveOption(move.moveDir))
			{
				((Selectable)this).OnMove(move);
			}
		}

		public void OnPointerClick(PointerEventData eventData)
		{
			if (((Selectable)this).interactable)
			{
				PointerClickCheckArrows(eventData);
			}
		}

		public void OnSubmit(BaseEventData eventData)
		{
			if (((Selectable)this).interactable)
			{
				if (applySettingOn == ApplyOnType.Submit)
				{
					ApplySettings();
				}
				else
				{
					MoveOption((MoveDirection)2);
				}
			}
		}

		protected bool MoveOption(MoveDirection dir)
		{
			//IL_0000: 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
			if ((int)dir != 0)
			{
				if ((int)dir != 2)
				{
					return false;
				}
				IncrementOption();
			}
			else
			{
				DecrementOption();
			}
			if (Object.op_Implicit((Object)(object)base.uiAudioPlayer))
			{
				base.uiAudioPlayer.PlaySlider();
			}
			return true;
		}

		protected void PointerClickCheckArrows(PointerEventData eventData)
		{
			if (Object.op_Implicit((Object)(object)base.leftCursor) && IsInside(((Component)base.leftCursor).gameObject, eventData))
			{
				MoveOption((MoveDirection)0);
			}
			else if (Object.op_Implicit((Object)(object)base.rightCursor) && IsInside(((Component)base.rightCursor).gameObject, eventData))
			{
				MoveOption((MoveDirection)2);
			}
			else
			{
				MoveOption((MoveDirection)2);
			}
		}

		private bool IsInside(GameObject obj, PointerEventData eventData)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			RectTransform component = obj.GetComponent<RectTransform>();
			if (Object.op_Implicit((Object)(object)component) && RectTransformUtility.RectangleContainsScreenPoint(component, eventData.position, Camera.main))
			{
				return true;
			}
			return false;
		}

		private string OptionToString(int index)
		{
			return Language.Get(((Enum)optionList[index]).GetLocalizationKey(), sheetTitle);
		}

		public string GetSelectedOptionText()
		{
			return OptionToString(selectedOptionIndex);
		}

		public virtual void SetOptionTo(int optionNumber)
		{
			if (optionNumber >= 0 && optionNumber < optionList.Count)
			{
				selectedOptionIndex = optionNumber;
				UpdateText();
				return;
			}
			Debug.LogErrorFormat("{0} - Trying to select an option outside the list size (index: {1} listsize: {2})", new object[3]
			{
				((Object)this).name,
				optionNumber,
				optionList.Count
			});
		}

		protected virtual void UpdateText()
		{
			if (!Extensions.IsNullOrEmpty<object>((ICollection<object>)optionList) && !((Object)(object)optionText == (Object)null))
			{
				optionText.text = GetSelectedOptionText();
				FixVerticalAlign component = ((Component)optionText).GetComponent<FixVerticalAlign>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.AlignText();
				}
			}
		}

		protected void UpdateSetting()
		{
			justUpdatedEntry = true;
			configEntry.BoxedValue = optionList[selectedOptionIndex];
		}

		protected void DecrementOption()
		{
			if (selectedOptionIndex > 0)
			{
				selectedOptionIndex--;
				if (applySettingOn == ApplyOnType.Scroll)
				{
					UpdateSetting();
				}
				UpdateText();
			}
			else if (selectedOptionIndex == 0)
			{
				selectedOptionIndex = optionList.Count - 1;
				if (applySettingOn == ApplyOnType.Scroll)
				{
					UpdateSetting();
				}
				UpdateText();
			}
			UpdateApplyButton();
		}

		protected void IncrementOption()
		{
			if (selectedOptionIndex >= 0 && selectedOptionIndex < optionList.Count - 1)
			{
				selectedOptionIndex++;
				if (applySettingOn == ApplyOnType.Scroll)
				{
					UpdateSetting();
				}
				UpdateText();
			}
			else if (selectedOptionIndex == optionList.Count - 1)
			{
				selectedOptionIndex = 0;
				if (applySettingOn == ApplyOnType.Scroll)
				{
					UpdateSetting();
				}
				UpdateText();
			}
			UpdateApplyButton();
		}

		public void RefreshMenuControls()
		{
			RefreshCurrentIndex();
			UpdateText();
		}

		public virtual void ApplySettings()
		{
			if (selectedOptionIndex >= 0)
			{
				UpdateSetting();
				RefreshCurrentIndex();
				HideApplyButton();
			}
		}

		public virtual void UpdateApplyButton()
		{
			if (currentActiveIndex == selectedOptionIndex)
			{
				HideApplyButton();
			}
			else
			{
				ShowApplyButton();
			}
		}

		public virtual void RefreshCurrentIndex()
		{
			if (configEntry != null)
			{
				int num = optionList.IndexOf(configEntry.BoxedValue);
				if (num == -1)
				{
					configEntry.BoxedValue = optionList[0];
					SetOptionTo(0);
				}
				else
				{
					SetOptionTo(num);
				}
			}
			currentActiveIndex = selectedOptionIndex;
		}

		protected void HideApplyButton()
		{
			if (hasApplyButton)
			{
				applyButton.alpha = 0f;
				applyButton.interactable = false;
				applyButton.blocksRaycasts = false;
			}
		}

		protected void ShowApplyButton()
		{
			if (applySettingOn != 0 && hasApplyButton)
			{
				applyButton.alpha = 1f;
				applyButton.interactable = true;
				applyButton.blocksRaycasts = true;
			}
		}
	}
	public static class Objects
	{
		public static class FontSize
		{
			public const int OptionLabel = 46;

			public const int OptionText = 38;

			public const int OptionDescription = 41;

			public const int MenuButton = 45;
		}

		public static GameObject CreateMenuButton(string buttonId, string label, MenuButtonType actionType, Action<BaseEventData> submitAction)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0050: 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_0073: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: 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)
			Action<BaseEventData> submitAction2 = submitAction;
			GameObject val = new GameObject(buttonId);
			val.AddComponent<RectTransform>();
			MenuButton val2 = val.AddComponent<MenuButton>();
			val2.buttonType = actionType;
			Navigation navigation = default(Navigation);
			((Navigation)(ref navigation)).mode = (Mode)4;
			((Selectable)val2).navigation = navigation;
			EventTrigger obj = val.AddComponent<EventTrigger>();
			Entry val3 = new Entry();
			val3.eventID = (EventTriggerType)15;
			((UnityEvent<BaseEventData>)(object)val3.callback).AddListener((UnityAction<BaseEventData>)delegate(BaseEventData data)
			{
				submitAction2(data);
			});
			Entry val4 = new Entry();
			val4.eventID = (EventTriggerType)4;
			((UnityEvent<BaseEventData>)(object)val4.callback).AddListener((UnityAction<BaseEventData>)delegate(BaseEventData data)
			{
				submitAction2(data);
			});
			obj.triggers.AddRange(new <>z__ReadOnlyArray<Entry>((Entry[])(object)new Entry[2] { val3, val4 }));
			GameObject val5 = new GameObject("Menu Button Text");
			RectTransform obj2 = val5.AddComponent<RectTransform>();
			obj2.anchorMax = Vector2.one;
			obj2.anchorMin = Vector2.zero;
			Text obj3 = val5.AddComponent<Text>();
			obj3.font = MenuResources.TrajanProBold;
			obj3.fontSize = 45;
			obj3.lineSpacing = -0.33f;
			obj3.text = label;
			obj3.alignment = (TextAnchor)4;
			ChangeTextFontScaleOnHandHeld obj4 = val5.AddComponent<ChangeTextFontScaleOnHandHeld>();
			obj4.normalSize = 45f;
			obj4.handHeldSize = 45f;
			val5.AddComponent<FixVerticalAlign>();
			ContentSizeFitter obj5 = val5.AddComponent<ContentSizeFitter>();
			obj5.horizontalFit = (FitMode)2;
			obj5.verticalFit = (FitMode)0;
			val5.transform.SetParent(val.transform);
			GameObject val6 = new GameObject("CursorRight");
			RectTransform obj6 = val6.AddComponent<RectTransform>();
			obj6.sizeDelta = new Vector2(164f, 119f);
			obj6.anchorMin = new Vector2(1f, 0.5f);
			obj6.anchorMax = new Vector2(1f, 0.5f);
			obj6.anchoredPosition = new Vector2(70f, 0f);
			((Transform)obj6).localScale = Vector2.op_Implicit(new Vector2(-0.9f, 0.9f));
			val6.AddComponent<Image>();
			Animator val7 = val6.AddComponent<Animator>();
			val7.runtimeAnimatorController = MenuResources.MenuCursorAnimator;
			val7.updateMode = (AnimatorUpdateMode)2;
			((MenuSelectable)val2).rightCursor = val7;
			val6.transform.SetParent(val5.transform, false);
			GameObject val8 = new GameObject("CursorLeft");
			RectTransform obj7 = val8.AddComponent<RectTransform>();
			obj7.sizeDelta = new Vector2(164f, 119f);
			obj7.anchorMin = new Vector2(0f, 0.5f);
			obj7.anchorMax = new Vector2(0f, 0.5f);
			obj7.anchoredPosition = new Vector2(-70f, 0f);
			((Transform)obj7).localScale = Vector2.op_Implicit(new Vector2(0.9f, 0.9f));
			val8.AddComponent<Image>();
			Animator val9 = val8.AddComponent<Animator>();
			val9.runtimeAnimatorController = MenuResources.MenuCursorAnimator;
			val9.updateMode = (AnimatorUpdateMode)2;
			((MenuSelectable)val2).leftCursor = val9;
			val8.transform.SetParent(val5.transform, false);
			return val;
		}

		public static GameObject CreateBepinexConfigOptionTranslated<T>(string objectId, string tlSheet, string labelKey, string descriptionKey, T[] options, ConfigEntry<T> entry)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: 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_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: 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_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: 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_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: 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_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: 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_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Unknown result type (might be due to invalid IL or missing references)
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_048e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(objectId);
			val.SetActive(false);
			val.AddComponent<RectTransform>().sizeDelta = new Vector2(1100f, 60f);
			val.AddComponent<CanvasRenderer>();
			BepinexMenuOptionHorizontal bepinexMenuOptionHorizontal = val.AddComponent<BepinexMenuOptionHorizontal>();
			bepinexMenuOptionHorizontal.optionList = options.Cast<object>().ToList();
			((Selectable)bepinexMenuOptionHorizontal).transition = (Transition)0;
			bepinexMenuOptionHorizontal.configEntry = (ConfigEntryBase)(object)entry;
			Navigation navigation = default(Navigation);
			((Navigation)(ref navigation)).mode = (Mode)4;
			((Selectable)bepinexMenuOptionHorizontal).navigation = navigation;
			bepinexMenuOptionHorizontal.sheetTitle = tlSheet;
			GameObject val2 = new GameObject("Menu Option Label");
			val2.SetActive(false);
			RectTransform obj = val2.AddComponent<RectTransform>();
			obj.anchoredPosition = new Vector2(450f, 0f);
			obj.sizeDelta = new Vector2(900f, 1f);
			obj.anchorMax = new Vector2(0f, 1f);
			obj.anchorMin = new Vector2(0f, 0f);
			Text val3 = val2.AddComponent<Text>();
			val3.alignment = (TextAnchor)3;
			val3.font = MenuResources.TrajanProBold;
			val3.fontSize = 46;
			val3.lineSpacing = -0.33f;
			val3.horizontalOverflow = (HorizontalWrapMode)1;
			AutoLocalizeTextUI obj2 = val2.AddComponent<AutoLocalizeTextUI>();
			obj2.textField = val3;
			obj2.text = new LocalisedString(tlSheet, labelKey);
			ChangeTextFontScaleOnHandHeld obj3 = val2.AddComponent<ChangeTextFontScaleOnHandHeld>();
			obj3.handHeldSize = 46f;
			obj3.normalSize = 46f;
			val2.AddComponent<FixVerticalAlign>();
			val2.transform.SetParent(val.transform, false);
			val2.SetActive(true);
			GameObject val4 = new GameObject("Menu Option Text");
			val4.SetActive(false);
			RectTransform obj4 = val4.AddComponent<RectTransform>();
			obj4.anchoredPosition = new Vector2(-100f, 0f);
			obj4.sizeDelta = new Vector2(200f, 1f);
			obj4.anchorMax = new Vector2(1f, 1f);
			obj4.anchorMin = new Vector2(1f, 0f);
			Text val5 = val4.AddComponent<Text>();
			val5.alignment = (TextAnchor)5;
			val5.font = MenuResources.TrajanProBold;
			val5.fontSize = 38;
			val5.lineSpacing = -0.33f;
			val5.horizontalOverflow = (HorizontalWrapMode)1;
			ChangeTextFontScaleOnHandHeld obj5 = val4.AddComponent<ChangeTextFontScaleOnHandHeld>();
			obj5.handHeldSize = 38f;
			obj5.normalSize = 38f;
			val4.AddComponent<FixVerticalAlign>();
			val4.transform.SetParent(val.transform, false);
			bepinexMenuOptionHorizontal.optionText = val5;
			val4.SetActive(true);
			GameObject val6 = new GameObject("CursorRight");
			RectTransform obj6 = val6.AddComponent<RectTransform>();
			obj6.sizeDelta = new Vector2(164f, 119f);
			obj6.anchorMin = new Vector2(1f, 0.5f);
			obj6.anchorMax = new Vector2(1f, 0.5f);
			obj6.anchoredPosition = new Vector2(70f, 0f);
			((Transform)obj6).localScale = Vector2.op_Implicit(new Vector2(-0.9f, 0.9f));
			val6.AddComponent<Image>();
			Animator val7 = val6.AddComponent<Animator>();
			val7.runtimeAnimatorController = MenuResources.MenuCursorAnimator;
			val7.updateMode = (AnimatorUpdateMode)2;
			((MenuSelectable)bepinexMenuOptionHorizontal).rightCursor = val7;
			val6.transform.SetParent(val.transform, false);
			GameObject val8 = new GameObject("CursorLeft");
			RectTransform obj7 = val8.AddComponent<RectTransform>();
			obj7.sizeDelta = new Vector2(164f, 119f);
			obj7.anchorMin = new Vector2(0f, 0.5f);
			obj7.anchorMax = new Vector2(0f, 0.5f);
			obj7.anchoredPosition = new Vector2(-70f, 0f);
			((Transform)obj7).localScale = Vector2.op_Implicit(new Vector2(0.9f, 0.9f));
			val8.AddComponent<Image>();
			Animator val9 = val8.AddComponent<Animator>();
			val9.runtimeAnimatorController = MenuResources.MenuCursorAnimator;
			val9.updateMode = (AnimatorUpdateMode)2;
			((MenuSelectable)bepinexMenuOptionHorizontal).leftCursor = val9;
			val8.transform.SetParent(val.transform, false);
			GameObject val10 = new GameObject("Description");
			val10.SetActive(false);
			RectTransform obj8 = val10.AddComponent<RectTransform>();
			obj8.anchoredPosition = new Vector2(2f, -55.8f);
			obj8.sizeDelta = new Vector2(875.1f, 61f);
			obj8.anchorMax = new Vector2(0f, 0.5f);
			obj8.anchorMin = new Vector2(0f, 0.5f);
			obj8.pivot = new Vector2(0f, 0.5f);
			Text val11 = val10.AddComponent<Text>();
			val11.alignment = (TextAnchor)3;
			val11.font = MenuResources.Perpetua;
			val11.fontSize = 41;
			val11.lineSpacing = 1f;
			val11.horizontalOverflow = (HorizontalWrapMode)1;
			AutoLocalizeTextUI obj9 = val10.AddComponent<AutoLocalizeTextUI>();
			obj9.textField = val11;
			obj9.text = new LocalisedString(tlSheet, descriptionKey);
			Animator val12 = val10.AddComponent<Animator>();
			val12.runtimeAnimatorController = (RuntimeAnimatorController)(object)MenuResources.TextHideShowAnimator;
			val12.updateMode = (AnimatorUpdateMode)2;
			ChangeTextFontScaleOnHandHeld obj10 = val10.AddComponent<ChangeTextFontScaleOnHandHeld>();
			obj10.handHeldSize = 41f;
			obj10.normalSize = 41f;
			val10.transform.SetParent(val.transform, false);
			((MenuSelectable)bepinexMenuOptionHorizontal).descriptionText = val12;
			val10.SetActive(true);
			val.SetActive(true);
			return val;
		}
	}
	public static class Utils
	{
		public static void Append<T>(ref T[] arr, T newElem)
		{
			T[] array = new T[arr.Length + 1];
			for (int i = 0; i < arr.Length; i++)
			{
				array[i] = arr[i];
			}
			array[arr.Length] = newElem;
			arr = array;
		}

		public static void InsertAfter<T>(ref T[] arr, T existingElem, T newElem)
		{
			T[] array = new T[arr.Length + 1];
			int i;
			for (i = 0; i < arr.Length; i++)
			{
				T val = (array[i] = arr[i]);
				if (val != null && val.Equals(existingElem))
				{
					break;
				}
			}
			if (i != arr.Length)
			{
				array[++i] = newElem;
				for (; i < arr.Length; i++)
				{
					array[i + 1] = arr[i];
				}
				arr = array;
			}
		}
	}
}
namespace GamepadUISwitcher
{
	[HarmonyPatch(typeof(UIButtonSkins), "GetButtonSkinFor", new Type[] { typeof(InputControlType) })]
	public class ButtonSkinsPatch
	{
		[HarmonyPrefix]
		public static void Prefix(ref GamepadType __state, ref InputHandler ___ih)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected I4, but got Unknown
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			__state = (GamepadType)(int)___ih.activeGamepadType;
			if ((int)___ih.activeGamepadType != 0)
			{
				___ih.activeGamepadType = GamepadUISwitcherPlugin.SelectedGamepadType;
			}
		}

		[HarmonyPostfix]
		public static void Postfix(ref GamepadType __state, ref InputHandler ___ih)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			___ih.activeGamepadType = __state;
		}
	}
	public class ControllerDetectPatch
	{
		[HarmonyPatch(typeof(ControllerDetect), "ShowController")]
		[HarmonyPrefix]
		public static void ShowAltController(ref GamepadType gamepadType)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected I4, but got Unknown
			if ((int)UIManager.instance.ih.activeGamepadType != 0)
			{
				gamepadType = (GamepadType)(int)GamepadUISwitcherPlugin.SelectedGamepadType;
			}
		}
	}
	public static class EnumExt
	{
		public static string GetLocalizationKey<T>(this T value) where T : Enum
		{
			Type type = value.GetType();
			if ((object)type == null || !type.IsEnum)
			{
				throw new ArgumentException("Value must be an enum");
			}
			string text = type.GetCustomAttribute<LocalizationKeyPrefixAttribute>()?.KeyPrefix ?? string.Empty;
			string text2 = value.ToString();
			MemberInfo[] member = type.GetMember(text2);
			if (member.Length == 0)
			{
				return text + text2;
			}
			LocalizationKeyAttribute customAttribute = member.First().GetCustomAttribute<LocalizationKeyAttribute>();
			if (customAttribute == null)
			{
				return text + text2;
			}
			if (customAttribute.IgnorePrefix)
			{
				return customAttribute.Key;
			}
			return text + customAttribute.Key;
		}
	}
	public static class FaceButtonSprites
	{
		public class Buttons
		{
			public Sprite a;

			public Sprite b;

			public Sprite x;

			public Sprite y;
		}

		public class PlaystationButtons
		{
			public Sprite cross;

			public Sprite circle;

			public Sprite triangle;

			public Sprite square;
		}

		public static Buttons nintendo;

		public static PlaystationButtons playstation;

		public static Buttons xbox;

		public static void LoadSpritesFromUIManager()
		{
			UIButtonSkins uiButtonSkins = UIManager.instance.uiButtonSkins;
			xbox.a = uiButtonSkins.a;
			xbox.b = uiButtonSkins.b;
			xbox.x = uiButtonSkins.x;
			xbox.y = uiButtonSkins.y;
			playstation.cross = uiButtonSkins.ps4x;
			playstation.circle = uiButtonSkins.ps4circle;
			playstation.square = uiButtonSkins.ps4square;
			playstation.triangle = uiButtonSkins.ps4triangle;
			nintendo.a = uiButtonSkins.switchHidA;
			nintendo.b = uiButtonSkins.switchHidB;
			nintendo.x = uiButtonSkins.switchHidX;
			nintendo.y = uiButtonSkins.switchHidY;
		}

		static FaceButtonSprites()
		{
			playstation = new PlaystationButtons();
			xbox = new Buttons();
			nintendo = new Buttons();
			LoadSpritesFromUIManager();
		}
	}
	[LocalizationKeyPrefix("SKIN_OPTION.VALUE.")]
	public enum GamepadButtonSkinOpt
	{
		Auto,
		Xbox360,
		XboxOne,
		XboxSeriesX,
		DualShock4,
		DualSense,
		SwitchJoycons,
		Switch2Joycons,
		SwitchPro,
		Switch2Pro,
		SteamDeck
	}
	[LocalizationKeyPrefix("SWAP_OPTION.VALUE.")]
	public enum GamepadButtonSwapOption
	{
		None,
		AB_XY,
		AB,
		XY,
		AX_BY,
		AX,
		BY,
		BX_AY,
		BX,
		AY
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("capitalistspz.gamepaduiswitcher-silksong", "GamepadUISwitcher", "1.2.1")]
	public class GamepadUISwitcherPlugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		internal static ConfigEntry<GamepadButtonSkinOpt> gamepadSkinConfig;

		internal static ConfigEntry<GamepadButtonSwapOption> gamepadButtonSwapConfig;

		public const string Id = "capitalistspz.gamepaduiswitcher-silksong";

		internal static GamepadType SelectedGamepadType => (GamepadType)(gamepadSkinConfig.Value switch
		{
			GamepadButtonSkinOpt.Xbox360 => 3, 
			GamepadButtonSkinOpt.XboxOne => 2, 
			GamepadButtonSkinOpt.XboxSeriesX => 12, 
			GamepadButtonSkinOpt.DualShock4 => 4, 
			GamepadButtonSkinOpt.DualSense => 11, 
			GamepadButtonSkinOpt.SwitchJoycons => 9, 
			GamepadButtonSkinOpt.Switch2Joycons => 14, 
			GamepadButtonSkinOpt.SwitchPro => 10, 
			GamepadButtonSkinOpt.Switch2Pro => 15, 
			GamepadButtonSkinOpt.SteamDeck => 13, 
			_ => UIManager.instance.ih.activeGamepadType, 
		});

		public static string Name => "GamepadUISwitcher";

		public static string Version => "1.2.1";

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			gamepadSkinConfig = ((BaseUnityPlugin)this).Config.Bind<GamepadButtonSkinOpt>("UI", "Gamepad Skin", GamepadButtonSkinOpt.Auto, (ConfigDescription)null);
			gamepadSkinConfig.SettingChanged += delegate
			{
				//IL_0001: 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)
				GamepadType val = (GamepadType)0;
				UIManager.instance.controllerDetect.ShowController(val);
				UIManager.instance.uiButtonSkins.RefreshButtonMappings();
			};
			gamepadButtonSwapConfig = ((BaseUnityPlugin)this).Config.Bind<GamepadButtonSwapOption>("UI", "Button Swap", GamepadButtonSwapOption.None, (ConfigDescription)null);
			gamepadButtonSwapConfig.SettingChanged += delegate
			{
				SetButtonSwapOptions();
				UIManager.instance.controllerDetect.ShowController((GamepadType)0);
			};
			Harmony obj = Harmony.CreateAndPatchAll(typeof(UIManagerPatch), (string)null);
			obj.PatchAll(typeof(ButtonSkinsPatch));
			obj.PatchAll(typeof(ControllerDetectPatch));
			Logger.LogInfo((object)("Plugin " + Name + " (capitalistspz.gamepaduiswitcher-silksong) has loaded!"));
		}

		public static void SetButtonSwapOptions()
		{
			//IL_0194: 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_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0605: Unknown result type (might be due to invalid IL or missing references)
			//IL_0612: Unknown result type (might be due to invalid IL or missing references)
			//IL_061e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0711: Unknown result type (might be due to invalid IL or missing references)
			//IL_071e: Unknown result type (might be due to invalid IL or missing references)
			//IL_072b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0737: Unknown result type (might be due to invalid IL or missing references)
			//IL_082a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0837: Unknown result type (might be due to invalid IL or missing references)
			//IL_0844: Unknown result type (might be due to invalid IL or missing references)
			//IL_0850: Unknown result type (might be due to invalid IL or missing references)
			//IL_0943: Unknown result type (might be due to invalid IL or missing references)
			//IL_0950: Unknown result type (might be due to invalid IL or missing references)
			//IL_095d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0969: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a69: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a76: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a82: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b75: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b82: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b8f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b9b: Unknown result type (might be due to invalid IL or missing references)
			string[] source = new string[9] { "Xbox360Buttons", "XboxOneButtons", "PS4Buttons", "SwitchJoyconButtons", "Switch2JoyconButtons", "SwitchProControllerButtons", "PS5Buttons", "XboxSeriesXButtons", "SteamDeckButtons" };
			UIButtonSkins uiButtonSkins = UIManager.instance.uiButtonSkins;
			IEnumerable<ControllerButtonPositions> enumerable = source.Select((string objName) => ((Component)((Component)UIManager.instance.gamepadMenuScreen).transform.Find("Content/ControllerProfiles/" + objName)).GetComponent<ControllerButtonPositions>());
			switch (gamepadButtonSwapConfig.Value)
			{
			case GamepadButtonSwapOption.None:
				uiButtonSkins.a = FaceButtonSprites.xbox.a;
				uiButtonSkins.b = FaceButtonSprites.xbox.b;
				uiButtonSkins.x = FaceButtonSprites.xbox.x;
				uiButtonSkins.y = FaceButtonSprites.xbox.y;
				uiButtonSkins.ps4x = FaceButtonSprites.playstation.cross;
				uiButtonSkins.ps4circle = FaceButtonSprites.playstation.circle;
				uiButtonSkins.ps4square = FaceButtonSprites.playstation.square;
				uiButtonSkins.ps4triangle = FaceButtonSprites.playstation.triangle;
				uiButtonSkins.switchHidA = FaceButtonSprites.nintendo.a;
				uiButtonSkins.switchHidB = FaceButtonSprites.nintendo.b;
				uiButtonSkins.switchHidX = FaceButtonSprites.nintendo.x;
				uiButtonSkins.switchHidY = FaceButtonSprites.nintendo.y;
				{
					foreach (ControllerButtonPositions item in enumerable)
					{
						item.action1.controllerButton = (InputControlType)19;
						item.action2.controllerButton = (InputControlType)20;
						item.action3.controllerButton = (InputControlType)21;
						item.action4.controllerButton = (InputControlType)22;
					}
					break;
				}
			case GamepadButtonSwapOption.AB_XY:
				uiButtonSkins.a = FaceButtonSprites.xbox.b;
				uiButtonSkins.b = FaceButtonSprites.xbox.a;
				uiButtonSkins.x = FaceButtonSprites.xbox.y;
				uiButtonSkins.y = FaceButtonSprites.xbox.x;
				uiButtonSkins.ps4x = FaceButtonSprites.playstation.circle;
				uiButtonSkins.ps4circle = FaceButtonSprites.playstation.cross;
				uiButtonSkins.ps4square = FaceButtonSprites.playstation.triangle;
				uiButtonSkins.ps4triangle = FaceButtonSprites.playstation.square;
				uiButtonSkins.switchHidA = FaceButtonSprites.nintendo.b;
				uiButtonSkins.switchHidB = FaceButtonSprites.nintendo.a;
				uiButtonSkins.switchHidX = FaceButtonSprites.nintendo.y;
				uiButtonSkins.switchHidY = FaceButtonSprites.nintendo.x;
				{
					foreach (ControllerButtonPositions item2 in enumerable)
					{
						item2.action1.controllerButton = (InputControlType)20;
						item2.action2.controllerButton = (InputControlType)19;
						item2.action3.controllerButton = (InputControlType)22;
						item2.action4.controllerButton = (InputControlType)21;
					}
					break;
				}
			case GamepadButtonSwapOption.AB:
				uiButtonSkins.a = FaceButtonSprites.xbox.b;
				uiButtonSkins.b = FaceButtonSprites.xbox.a;
				uiButtonSkins.x = FaceButtonSprites.xbox.x;
				uiButtonSkins.y = FaceButtonSprites.xbox.y;
				uiButtonSkins.ps4x = FaceButtonSprites.playstation.circle;
				uiButtonSkins.ps4circle = FaceButtonSprites.playstation.cross;
				uiButtonSkins.ps4square = FaceButtonSprites.playstation.square;
				uiButtonSkins.ps4triangle = FaceButtonSprites.playstation.triangle;
				uiButtonSkins.switchHidA = FaceButtonSprites.nintendo.b;
				uiButtonSkins.switchHidB = FaceButtonSprites.nintendo.a;
				uiButtonSkins.switchHidX = FaceButtonSprites.nintendo.x;
				uiButtonSkins.switchHidY = FaceButtonSprites.nintendo.y;
				{
					foreach (ControllerButtonPositions item3 in enumerable)
					{
						item3.action1.controllerButton = (InputControlType)20;
						item3.action2.controllerButton = (InputControlType)19;
						item3.action3.controllerButton = (InputControlType)21;
						item3.action4.controllerButton = (InputControlType)22;
					}
					break;
				}
			case GamepadButtonSwapOption.XY:
				uiButtonSkins.a = FaceButtonSprites.xbox.a;
				uiButtonSkins.b = FaceButtonSprites.xbox.b;
				uiButtonSkins.x = FaceButtonSprites.xbox.y;
				uiButtonSkins.y = FaceButtonSprites.xbox.x;
				uiButtonSkins.ps4x = FaceButtonSprites.playstation.cross;
				uiButtonSkins.ps4circle = FaceButtonSprites.playstation.circle;
				uiButtonSkins.ps4square = FaceButtonSprites.playstation.triangle;
				uiButtonSkins.ps4triangle = FaceButtonSprites.playstation.square;
				uiButtonSkins.switchHidA = FaceButtonSprites.nintendo.a;
				uiButtonSkins.switchHidB = FaceButtonSprites.nintendo.b;
				uiButtonSkins.switchHidX = FaceButtonSprites.nintendo.y;
				uiButtonSkins.switchHidY = FaceButtonSprites.nintendo.x;
				{
					foreach (ControllerButtonPositions item4 in enumerable)
					{
						item4.action1.controllerButton = (InputControlType)19;
						item4.action2.controllerButton = (InputControlType)20;
						item4.action3.controllerButton = (InputControlType)22;
						item4.action4.controllerButton = (InputControlType)21;
					}
					break;
				}
			case GamepadButtonSwapOption.AX_BY:
				uiButtonSkins.a = FaceButtonSprites.xbox.x;
				uiButtonSkins.b = FaceButtonSprites.xbox.y;
				uiButtonSkins.x = FaceButtonSprites.xbox.a;
				uiButtonSkins.y = FaceButtonSprites.xbox.b;
				uiButtonSkins.ps4x = FaceButtonSprites.playstation.square;
				uiButtonSkins.ps4circle = FaceButtonSprites.playstation.triangle;
				uiButtonSkins.ps4square = FaceButtonSprites.playstation.cross;
				uiButtonSkins.ps4triangle = FaceButtonSprites.playstation.circle;
				uiButtonSkins.switchHidA = FaceButtonSprites.nintendo.x;
				uiButtonSkins.switchHidB = FaceButtonSprites.nintendo.y;
				uiButtonSkins.switchHidX = FaceButtonSprites.nintendo.a;
				uiButtonSkins.switchHidY = FaceButtonSprites.nintendo.b;
				{
					foreach (ControllerButtonPositions item5 in enumerable)
					{
						item5.action1.controllerButton = (InputControlType)21;
						item5.action2.controllerButton = (InputControlType)22;
						item5.action3.controllerButton = (InputControlType)19;
						item5.action4.controllerButton = (InputControlType)20;
					}
					break;
				}
			case GamepadButtonSwapOption.AX:
				uiButtonSkins.a = FaceButtonSprites.xbox.x;
				uiButtonSkins.b = FaceButtonSprites.xbox.b;
				uiButtonSkins.x = FaceButtonSprites.xbox.x;
				uiButtonSkins.y = FaceButtonSprites.xbox.y;
				uiButtonSkins.ps4x = FaceButtonSprites.playstation.square;
				uiButtonSkins.ps4circle = FaceButtonSprites.playstation.circle;
				uiButtonSkins.ps4square = FaceButtonSprites.playstation.cross;
				uiButtonSkins.ps4triangle = FaceButtonSprites.playstation.triangle;
				uiButtonSkins.switchHidA = FaceButtonSprites.nintendo.x;
				uiButtonSkins.switchHidB = FaceButtonSprites.nintendo.b;
				uiButtonSkins.switchHidX = FaceButtonSprites.nintendo.a;
				uiButtonSkins.switchHidY = FaceButtonSprites.nintendo.y;
				{
					foreach (ControllerButtonPositions item6 in enumerable)
					{
						item6.action1.controllerButton = (InputControlType)21;
						item6.action2.controllerButton = (InputControlType)20;
						item6.action3.controllerButton = (InputControlType)19;
						item6.action4.controllerButton = (InputControlType)22;
					}
					break;
				}
			case GamepadButtonSwapOption.BY:
				uiButtonSkins.a = FaceButtonSprites.xbox.a;
				uiButtonSkins.b = FaceButtonSprites.xbox.y;
				uiButtonSkins.x = FaceButtonSprites.xbox.x;
				uiButtonSkins.y = FaceButtonSprites.xbox.b;
				uiButtonSkins.ps4x = FaceButtonSprites.playstation.cross;
				uiButtonSkins.ps4circle = FaceButtonSprites.playstation.triangle;
				uiButtonSkins.ps4square = FaceButtonSprites.playstation.square;
				uiButtonSkins.ps4triangle = FaceButtonSprites.playstation.circle;
				uiButtonSkins.switchHidA = FaceButtonSprites.nintendo.a;
				uiButtonSkins.switchHidB = FaceButtonSprites.nintendo.y;
				uiButtonSkins.switchHidX = FaceButtonSprites.nintendo.x;
				uiButtonSkins.switchHidY = FaceButtonSprites.nintendo.b;
				{
					foreach (ControllerButtonPositions item7 in enumerable)
					{
						item7.action1.controllerButton = (InputControlType)19;
						item7.action2.controllerButton = (InputControlType)22;
						item7.action3.controllerButton = (InputControlType)21;
						item7.action4.controllerButton = (InputControlType)20;
					}
					break;
				}
			case GamepadButtonSwapOption.BX_AY:
				uiButtonSkins.a = FaceButtonSprites.xbox.y;
				uiButtonSkins.b = FaceButtonSprites.xbox.x;
				uiButtonSkins.x = FaceButtonSprites.xbox.b;
				uiButtonSkins.y = FaceButtonSprites.xbox.a;
				uiButtonSkins.ps4x = FaceButtonSprites.playstation.triangle;
				uiButtonSkins.ps4circle = FaceButtonSprites.playstation.square;
				uiButtonSkins.ps4square = FaceButtonSprites.playstation.circle;
				uiButtonSkins.ps4triangle = FaceButtonSprites.playstation.cross;
				uiButtonSkins.switchHidA = FaceButtonSprites.nintendo.y;
				uiButtonSkins.switchHidB = FaceButtonSprites.nintendo.x;
				uiButtonSkins.switchHidX = FaceButtonSprites.nintendo.b;
				uiButtonSkins.switchHidY = FaceButtonSprites.nintendo.a;
				{
					foreach (ControllerButtonPositions item8 in enumerable)
					{
						item8.action1.controllerButton = (InputControlType)22;
						item8.action2.controllerButton = (InputControlType)21;
						item8.action3.controllerButton = (InputControlType)20;
						item8.action4.controllerButton = (InputControlType)19;
					}
					break;
				}
			case GamepadButtonSwapOption.BX:
				uiButtonSkins.a = FaceButtonSprites.xbox.a;
				uiButtonSkins.b = FaceButtonSprites.xbox.x;
				uiButtonSkins.x = FaceButtonSprites.xbox.b;
				uiButtonSkins.y = FaceButtonSprites.xbox.y;
				uiButtonSkins.ps4x = FaceButtonSprites.playstation.cross;
				uiButtonSkins.ps4circle = FaceButtonSprites.playstation.square;
				uiButtonSkins.ps4square = FaceButtonSprites.playstation.circle;
				uiButtonSkins.ps4triangle = FaceButtonSprites.playstation.triangle;
				uiButtonSkins.switchHidA = FaceButtonSprites.nintendo.a;
				uiButtonSkins.switchHidB = FaceButtonSprites.nintendo.x;
				uiButtonSkins.switchHidX = FaceButtonSprites.nintendo.b;
				uiButtonSkins.switchHidY = FaceButtonSprites.nintendo.y;
				{
					foreach (ControllerButtonPositions item9 in enumerable)
					{
						item9.action1.controllerButton = (InputControlType)19;
						item9.action2.controllerButton = (InputControlType)21;
						item9.action3.controllerButton = (InputControlType)20;
						item9.action4.controllerButton = (InputControlType)22;
					}
					break;
				}
			case GamepadButtonSwapOption.AY:
				uiButtonSkins.a = FaceButtonSprites.xbox.y;
				uiButtonSkins.b = FaceButtonSprites.xbox.b;
				uiButtonSkins.x = FaceButtonSprites.xbox.x;
				uiButtonSkins.y = FaceButtonSprites.xbox.a;
				uiButtonSkins.ps4x = FaceButtonSprites.playstation.triangle;
				uiButtonSkins.ps4circle = FaceButtonSprites.playstation.circle;
				uiButtonSkins.ps4square = FaceButtonSprites.playstation.square;
				uiButtonSkins.ps4triangle = FaceButtonSprites.playstation.cross;
				uiButtonSkins.switchHidA = FaceButtonSprites.nintendo.y;
				uiButtonSkins.switchHidB = FaceButtonSprites.nintendo.b;
				uiButtonSkins.switchHidX = FaceButtonSprites.nintendo.x;
				uiButtonSkins.switchHidY = FaceButtonSprites.nintendo.a;
				{
					foreach (ControllerButtonPositions item10 in enumerable)
					{
						item10.action1.controllerButton = (InputControlType)22;
						item10.action2.controllerButton = (InputControlType)20;
						item10.action3.controllerButton = (InputControlType)21;
						item10.action4.controllerButton = (InputControlType)19;
					}
					break;
				}
			default:
				throw new ArgumentOutOfRangeException();
			}
		}
	}
	[AttributeUsage(AttributeTargets.Field)]
	public class LocalizationKeyAttribute : Attribute
	{
		public string Key { get; }

		public bool IgnorePrefix { get; }

		public LocalizationKeyAttribute(string key, bool ignorePrefix = false)
		{
			Key = key;
			IgnorePrefix = ignorePrefix;
			base..ctor();
		}
	}
	[AttributeUsage(AttributeTargets.Enum)]
	public class LocalizationKeyPrefixAttribute : Attribute
	{
		public string KeyPrefix { get; }

		public LocalizationKeyPrefixAttribute(string keyPrefix)
		{
			KeyPrefix = keyPrefix;
			base..ctor();
		}
	}
	public class UIManagerPatch
	{
		[HarmonyPatch(typeof(UIManager), "Awake")]
		[HarmonyPostfix]
		public static void OnAwake()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: 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_0145: Expected O, but got Unknown
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Expected O, but got Unknown
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Expected O, but got Unknown
			MenuScreen gamepadMenuScreen = UIManager.instance.gamepadMenuScreen;
			VerticalLayoutGroup obj = Extensions.AddComponentIfNotPresent<VerticalLayoutGroup>(((Component)gamepadMenuScreen).gameObject);
			((LayoutGroup)obj).childAlignment = (TextAnchor)4;
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)obj).childScaleHeight = true;
			((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = false;
			Transform obj2 = ((Component)gamepadMenuScreen).transform.Find("Content");
			Transform obj3 = ((obj2 is RectTransform) ? obj2 : null);
			Transform obj4 = obj3.Find("ControllerProfiles");
			RectTransform val = (RectTransform)(object)((obj4 is RectTransform) ? obj4 : null);
			((RectTransform)obj3).sizeDelta = val.sizeDelta;
			Transform val2 = ((Component)gamepadMenuScreen).transform.Find("Controls");
			VerticalLayoutGroup component = ((Component)val2).GetComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)component).spacing = ((HorizontalOrVerticalLayoutGroup)component).spacing * 0.75f;
			((LayoutGroup)component).childAlignment = (TextAnchor)4;
			Transform val3 = val2.Find("RumbleSetting");
			GameObject val4 = new GameObject("GamepadSkinSetting");
			Extensions.AddComponentIfNotPresent<RectTransform>(val4);
			val4.transform.SetParent(val2, false);
			val4.transform.SetSiblingIndex(val3.GetSiblingIndex() + 1);
			GameObject val5 = Objects.CreateBepinexConfigOptionTranslated("GamepadSkinOption", "Mods.capitalistspz.gamepaduiswitcher-silksong", "SKIN_OPTION.LABEL", "SKIN_OPTION.DESCRIPTION", (GamepadButtonSkinOpt[])Enum.GetValues(typeof(GamepadButtonSkinOpt)), GamepadUISwitcherPlugin.gamepadSkinConfig);
			val5.transform.SetParent(val4.transform, false);
			Entry val6 = new Entry
			{
				selectable = (Selectable)(object)val5.GetComponent<MenuSelectable>(),
				alsoAffectParent = true,
				forceEnable = false,
				condition = null
			};
			MenuButtonList component2 = ((Component)gamepadMenuScreen).GetComponent<MenuButtonList>();
			Utils.InsertAfter(existingElem: component2.entries.First((Entry entry) => ((Object)entry.selectable).name == "RumblePopupOption"), arr: ref component2.entries, newElem: val6);
			GameObject val7 = new GameObject("GamepadButtonSwapOption");
			Extensions.AddComponentIfNotPresent<RectTransform>(val7);
			val7.transform.SetParent(val2, false);
			val7.transform.SetSiblingIndex(val4.transform.GetSiblingIndex() + 1);
			GameObject val8 = Objects.CreateBepinexConfigOptionTranslated("GamepadSwapOption", "Mods.capitalistspz.gamepaduiswitcher-silksong", "SWAP_OPTION.LABEL", "SWAP_OPTION.DESCRIPTION", (GamepadButtonSwapOption[])Enum.GetValues(typeof(GamepadButtonSwapOption)), GamepadUISwitcherPlugin.gamepadButtonSwapConfig);
			val8.transform.SetParent(val7.transform, false);
			Utils.InsertAfter(newElem: new Entry
			{
				selectable = (Selectable)(object)val8.GetComponent<MenuSelectable>(),
				alsoAffectParent = true,
				forceEnable = false
			}, arr: ref component2.entries, existingElem: val6);
			GamepadUISwitcherPlugin.SetButtonSwapOptions();
		}
	}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	int ICollection.Count => _items.Length;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => _items.Length;

	T IReadOnlyList<T>.this[int index] => _items[index];

	int ICollection<T>.Count => _items.Length;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlyArray(T[] items)
	{
		_items = items;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return ((IEnumerable)_items).GetEnumerator();
	}

	void ICollection.CopyTo(Array array, int index)
	{
		((ICollection)_items).CopyTo(array, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return ((IList)_items).Contains(value);
	}

	int IList.IndexOf(object value)
	{
		return ((IList)_items).IndexOf(value);
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return ((IEnumerable<T>)_items).GetEnumerator();
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return ((ICollection<T>)_items).Contains(item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		((ICollection<T>)_items).CopyTo(array, arrayIndex);
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		return ((IList<T>)_items).IndexOf(item);
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}