Decompiled source of ProControllerFix v1.0.1

plugins/ProControllerGlyphs.dll

Decompiled 9 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("OutwardModTemplate")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OutwardModTemplate")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c5450fe0-edcf-483f-b9ea-4b1ef9d36da7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ProControllerFix;

[BepInPlugin("technicalslayer.procontrollerfix", "Pro Controller Fix", "1.0.1")]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(QuickSlotDisplay), "RefreshInput")]
	public class QuickslotDisplay_RefreshInput
	{
		[HarmonyPostfix]
		public static void Postfix(QuickSlotDisplay __instance)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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)
			int num = 0;
			num = __instance.RefSlotID switch
			{
				0 => 2, 
				1 => 1, 
				2 => 4, 
				3 => 3, 
				4 => 6, 
				5 => 5, 
				6 => 8, 
				7 => 7, 
				_ => 0, 
			};
			GlyphData firstElementMapWithQuickSlot = ControlsInput.GetFirstElementMapWithQuickSlot(((UIElement)__instance).m_characterUI.RewiredID, (QuickSlotIDs)num, __instance.m_gamepadMode);
			__instance.m_inputIcon.overrideSprite = UIUtilities.Controller.GetGlyph(firstElementMapWithQuickSlot.controllerGUI, firstElementMapWithQuickSlot.aem, (string)null);
		}
	}

	[HarmonyPatch(typeof(ControlsInput), "QuickSlot1")]
	public class ControlsInput_QuickSlot1
	{
		[HarmonyPostfix]
		public static void Postfix(ref bool __result, ControlsInput __instance, ref int _playerID)
		{
			__result = ControlsInput.m_playerInputManager[_playerID].GetButtonDown("QuickSlot2");
		}
	}

	[HarmonyPatch(typeof(ControlsInput), "QuickSlot2")]
	public class ControlsInput_QuickSlot2
	{
		[HarmonyPostfix]
		public static void Postfix(ref bool __result, ControlsInput __instance, ref int _playerID)
		{
			__result = ControlsInput.m_playerInputManager[_playerID].GetButtonDown("QuickSlot1");
		}
	}

	[HarmonyPatch(typeof(ControlsInput), "QuickSlot3")]
	public class ControlsInput_QuickSlot3
	{
		[HarmonyPostfix]
		public static void Postfix(ref bool __result, ControlsInput __instance, ref int _playerID)
		{
			__result = ControlsInput.m_playerInputManager[_playerID].GetButtonDown("QuickSlot4");
		}
	}

	[HarmonyPatch(typeof(ControlsInput), "QuickSlot4")]
	public class ControlsInput_QuickSlot4
	{
		[HarmonyPostfix]
		public static void Postfix(ref bool __result, ControlsInput __instance, ref int _playerID)
		{
			__result = ControlsInput.m_playerInputManager[_playerID].GetButtonDown("QuickSlot3");
		}
	}

	public const string GUID = "technicalslayer.procontrollerfix";

	public const string NAME = "Pro Controller Fix";

	public const string VERSION = "1.0.1";

	internal static ManualLogSource Log;

	public static ConfigEntry<bool> ExampleConfig;

	internal void Awake()
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogMessage((object)"Hello world from Pro Controller Fix 1.0.1!");
		ExampleConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("ExampleCategory", "ExampleSetting", false, "This is an example setting.");
		new Harmony("technicalslayer.procontrollerfix").PatchAll();
	}

	private static Transform GetMenuPanelsHolder(CharacterUI ui)
	{
		return ((Component)ui).transform.Find("Canvas/GameplayPanels/Menus/CharacterMenus/MainPanel/Content/MiddlePanel/QuickSlotPanel/PanelSwitcher/Controller/LT-RT");
	}

	private static Transform GetGameQuickSlotsRT(CharacterUI ui)
	{
		return ((Component)ui).transform.Find("Canvas/GameplayPanels/HUD/QuickSlot/Controller/LT-RT/RT/QuickSlots");
	}

	private static Transform GetGameQuickSlotsLT(CharacterUI ui)
	{
		return ((Component)ui).transform.Find("Canvas/GameplayPanels/HUD/QuickSlot/Controller/LT-RT/LT/QuickSlots");
	}
}