using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using HarmonyLib; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ControllerAutoPickupFix")] [assembly: AssemblyDescription("Disables Valheim's controller shortcut for toggling auto-pickup. Keyboard V still works normally.")] [assembly: AssemblyProduct("ControllerAutoPickupFix")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyVersion("0.1.0.0")] namespace ControllerAutoPickupFix; [BepInPlugin("ControllerAutoPickupFix", "ControllerAutoPickupFix", "0.1.0")] [BepInProcess("valheim.exe")] public sealed class ControllerAutoPickupFixPlugin : BaseUnityPlugin { public const string PluginGuid = "ControllerAutoPickupFix"; public const string PluginName = "ControllerAutoPickupFix"; public const string PluginVersion = "0.1.0"; private Harmony _harmony; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown _harmony = new Harmony("ControllerAutoPickupFix"); _harmony.PatchAll(typeof(ControllerAutoPickupFixPlugin).Assembly); } private void OnDestroy() { if (_harmony != null) { _harmony.UnpatchSelf(); _harmony = null; } } } [HarmonyPatch(typeof(ZInput), "GetButtonDown", new Type[] { typeof(string) })] internal static class ControllerAutoPickupInputPatch { [HarmonyPrefix] private static bool Prefix(string __0, ref bool __result) { if (!string.Equals(__0, "JoyAutoPickup", StringComparison.Ordinal)) { return true; } __result = false; return false; } }