Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of RememberServerPassword GamepadFix v0.1.0
plugins/RememberServerPassword_GamepadFix.dll
Decompiled 2 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("RememberServerPassword_GamepadFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+8bfaed0eca8c70705f943aba29aac855b5f22c64")] [assembly: AssemblyProduct("RememberServerPassword_GamepadFix")] [assembly: AssemblyTitle("RememberServerPassword_GamepadFix")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 RememberServerPasswordGamepadFix { [BepInPlugin("rgeraskin.valheim.rememberserverpassword.gamepadfix", "RememberServerPassword Gamepad Fix", "0.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string Guid = "rgeraskin.valheim.rememberserverpassword.gamepadfix"; public const string Name = "RememberServerPassword Gamepad Fix"; public const string Version = "0.1.0"; internal const string TargetGuid = "magicorp.valheim.rememberserverpassword"; internal static Plugin Instance; private void Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) Instance = this; new Harmony("rgeraskin.valheim.rememberserverpassword.gamepadfix").PatchAll(); } internal static void Log(string message) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)message); } internal static void Warn(string message) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)message); } } [HarmonyPatch(typeof(FejdStartup), "SetupGui")] internal static class SetupGuiPatch { [HarmonyAfter(new string[] { "magicorp.valheim.rememberserverpassword" })] private static void Postfix(FejdStartup __instance) { QuickConnectNavigation.Link(__instance); } } internal static class QuickConnectNavigation { private const string QuickConnectObjectName = "MagiCorp_RememberServerPassword_QuickConnect"; internal static void Link(FejdStartup startup) { //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Invalid comparison between Unknown and I4 //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: 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_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: 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_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: 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) try { object? obj = AccessTools.Field(typeof(FejdStartup), "m_menuList")?.GetValue(startup); GameObject val = (GameObject)((obj is GameObject) ? obj : null); FieldInfo fieldInfo = AccessTools.Field(typeof(FejdStartup), "m_menuButtons"); Button[] array = fieldInfo?.GetValue(startup) as Button[]; if ((Object)(object)val == (Object)null || array == null) { return; } Button quick = null; Button[] componentsInChildren = val.GetComponentsInChildren<Button>(true); foreach (Button val2 in componentsInChildren) { if (((Object)((Component)val2).gameObject).name == "MagiCorp_RememberServerPassword_QuickConnect") { quick = val2; } } if ((Object)(object)quick == (Object)null) { return; } Button val3 = Array.Find(array, (Button b) => (Object)(object)b != (Object)null && (Object)(object)b != (Object)(object)quick); if ((Object)(object)val3 != (Object)null) { CopySelectionVisuals(val3, quick); } if ((Object)(object)quick == (Object)null || !((Component)quick).gameObject.activeSelf || !((Selectable)quick).interactable || Array.IndexOf(array, quick) >= 0) { return; } float y = ((Component)quick).transform.position.y; int num = -1; for (int num2 = 0; num2 < array.Length; num2++) { if (!((Object)(object)array[num2] == (Object)null)) { float y2 = ((Component)array[num2]).transform.position.y; if (y2 > y && (num < 0 || y2 < ((Component)array[num]).transform.position.y)) { num = num2; } } } Button val4 = ((num >= 0) ? array[num] : null); List<Button> list = new List<Button>(array); list.Insert(num + 1, quick); fieldInfo.SetValue(startup, list.ToArray()); Navigation navigation = ((Selectable)quick).navigation; if ((int)((Navigation)(ref navigation)).mode == 4) { object obj2; Navigation navigation2; if (!((Object)(object)val4 != (Object)null)) { obj2 = ((num + 2 < list.Count) ? list[num + 2] : null); } else { navigation2 = ((Selectable)val4).navigation; obj2 = ((Navigation)(ref navigation2)).selectOnDown; } Selectable val5 = (Selectable)obj2; ((Navigation)(ref navigation)).selectOnUp = (Selectable)(object)val4; ((Navigation)(ref navigation)).selectOnDown = val5; ((Selectable)quick).navigation = navigation; if ((Object)(object)val4 != (Object)null) { Navigation navigation3 = ((Selectable)val4).navigation; ((Navigation)(ref navigation3)).selectOnDown = (Selectable)(object)quick; ((Selectable)val4).navigation = navigation3; } if ((Object)(object)val5 != (Object)null) { navigation2 = val5.navigation; if ((Object)(object)((Navigation)(ref navigation2)).selectOnUp == (Object)(object)val4) { Navigation navigation4 = val5.navigation; ((Navigation)(ref navigation4)).selectOnUp = (Selectable)(object)quick; val5.navigation = navigation4; } } } Plugin.Log($"Linked Quick Connect into menu navigation: mode={((Navigation)(ref navigation)).mode}, " + $"up={Name((Component)(object)((Navigation)(ref navigation)).selectOnUp)}, down={Name((Component)(object)((Navigation)(ref navigation)).selectOnDown)}, keyboardIndex={num + 1}"); } catch (Exception ex) { Plugin.Warn("Could not link Quick Connect navigation: " + ex.Message); } } private static void CopySelectionVisuals(Button reference, Button quick) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0025: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0050: 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_0068: Unknown result type (might be due to invalid IL or missing references) AnimationTriggers animationTriggers = ((Selectable)reference).animationTriggers; ((Selectable)quick).animationTriggers = new AnimationTriggers { normalTrigger = animationTriggers.normalTrigger, highlightedTrigger = animationTriggers.highlightedTrigger, pressedTrigger = animationTriggers.pressedTrigger, selectedTrigger = animationTriggers.selectedTrigger, disabledTrigger = animationTriggers.disabledTrigger }; ((Selectable)quick).transition = ((Selectable)reference).transition; ((Selectable)quick).colors = ((Selectable)reference).colors; ((Selectable)quick).spriteState = ((Selectable)reference).spriteState; } private static string Name(Component c) { if (!((Object)(object)c != (Object)null)) { return "<none>"; } return ((Object)c.gameObject).name; } } }