Decompiled source of keyBainDofIX v1.0.0

InputUtilsFix.dll

Decompiled 2 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using LethalCompanyInputUtils.Components;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("InputUtilsFix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("InputUtilsFix")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8908cb1a-063b-4cb9-bfe1-335fcf9747fe")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FixRebindButtonMod;

[BepInPlugin("Ryoryoman_InputUtilsFix", "InputUtilsFix", "1.0.0")]
public class FixRebindButtonPlugin : BaseUnityPlugin
{
	private const string modGUID = "Ryoryoman_InputUtilsFix";

	private const string modName = "InputUtilsFix";

	private const string modVersion = "1.0.0";

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("Ryoryoman_InputUtilsFix");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Ryoryoman_InputUtilsFix loaded successfully.");
	}
}
[HarmonyPatch(typeof(RebindButton))]
internal static class RebindButtonPatch
{
	[HarmonyPrefix]
	[HarmonyPatch("StartRebinding")]
	private static void PrefixStartRebinding(RebindButton __instance)
	{
		try
		{
			FieldInfo fieldInfo = AccessTools.Field(typeof(RebindButton), "_key");
			object value = fieldInfo.GetValue(__instance);
			if (value == null)
			{
				return;
			}
			FieldInfo fieldInfo2 = AccessTools.Field(value.GetType(), "currentInput");
			object? value2 = fieldInfo2.GetValue(value);
			InputActionReference val = (InputActionReference)((value2 is InputActionReference) ? value2 : null);
			if (!((Object)(object)val == (Object)null) && val.action != null)
			{
				InputAction action = val.action;
				if (action.enabled)
				{
					Debug.Log((object)("[FixRebindButtonPatch] Disabling action before rebinding: " + action.name));
					action.Disable();
				}
			}
		}
		catch (Exception arg)
		{
			Debug.LogError((object)$"[FixRebindButtonPatch] Failed to disable action before rebinding: {arg}");
		}
	}
}