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 CorrectControllerIcon v0.1.0
CorrectControllerIcon.dll
Decompiled 10 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LethalCompanyInputUtils; using LethalCompanyInputUtils.Components; using LethalCompanyInputUtils.Glyphs; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("LethalCompanyInputUtils")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CorrectControllerIcon")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("One Xbox / PlayStation choice in InputUtils' keybind menu, which every mod built on it follows.")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("CorrectControllerIcon")] [assembly: AssemblyTitle("CorrectControllerIcon")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [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 CorrectControllerIcon { internal static class Choice { internal static bool PlayStation => Plugin.Icons.Value == ControllerIcons.PlayStation; internal static ControllerGlyph Glyphs { get { if (Plugin.Icons.Value == ControllerIcons.Auto) { return null; } foreach (ControllerGlyph instance in ControllerGlyph.Instances) { if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance == (Object)(object)ControllerGlyph.MouseGlyphs) && IsPlayStation(instance) == PlayStation) { return instance; } } return null; } } private static bool IsPlayStation(ControllerGlyph glyph) { if (((Object)glyph).name.IndexOf("dual", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } foreach (string validGamepadType in glyph.validGamepadTypes) { if (validGamepadType.IndexOf("Dual", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; } } internal static class IconChoice { [HarmonyPatch(typeof(ControllerGlyph), "GetBestMatching")] private static class GlyphPatch { private static void Postfix(ref ControllerGlyph __result) { if (!((Object)(object)__result != (Object)null) || !((Object)(object)__result == (Object)(object)ControllerGlyph.MouseGlyphs)) { ControllerGlyph glyphs = Choice.Glyphs; if ((Object)(object)glyphs != (Object)null) { __result = glyphs; } } } } [HarmonyPatch(typeof(KepRemapPanel), "OnEnable")] private static class PanelPatch { private static void Postfix() { RemapContainerController containerInstance = LcInputActionApi.ContainerInstance; if (!((Object)(object)containerInstance == (Object)null)) { if ((Object)(object)((Component)containerInstance).transform.Find("CorrectControllerIconChoice") == (Object)null) { Create(containerInstance); } UpdateLabel(); } } } private const string ObjectName = "CorrectControllerIconChoice"; private static TMP_Dropdown icons; private static void Create(RemapContainerController container) { //IL_00b1: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown TMP_Dropdown overridePriorityDropdown = container.overridePriorityDropdown; if ((Object)(object)overridePriorityDropdown == (Object)null || (Object)(object)((Component)overridePriorityDropdown).transform.parent == (Object)(object)((Component)container).transform) { Plugin.mlg.LogWarning((object)"InputUtils' dropdown is not where it used to be, the icon choice is only in the config."); return; } GameObject val = Object.Instantiate<GameObject>(((Component)((Component)overridePriorityDropdown).transform.parent).gameObject, ((Component)container).transform); ((Object)val).name = "CorrectControllerIconChoice"; LocaleResolver[] componentsInChildren = val.GetComponentsInChildren<LocaleResolver>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } Transform val2 = val.transform.Find("Info Slot"); if ((Object)(object)val2 != (Object)null) { ((Component)val2).gameObject.SetActive(false); } RectTransform val3 = (RectTransform)val.transform; Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(1f, 1f); val3.anchorMax = val4; val3.anchorMin = val4; val3.pivot = new Vector2(1f, 0.5f); val3.anchoredPosition = new Vector2(-15f, 45f); icons = val.GetComponentInChildren<TMP_Dropdown>(true); icons.onValueChanged = new DropdownEvent(); icons.ClearOptions(); List<string> list = new List<string>(); foreach (ControllerIcons value in Enum.GetValues(typeof(ControllerIcons))) { list.Add("Icons: " + value); } icons.AddOptions(list); ((UnityEvent<int>)(object)icons.onValueChanged).AddListener((UnityAction<int>)delegate(int value) { Plugin.Icons.Value = (ControllerIcons)value; }); } internal static void UpdateLabel() { if ((Object)(object)icons != (Object)null) { icons.SetValueWithoutNotify((int)Plugin.Icons.Value); } } } public enum ControllerIcons { Auto, Xbox, PlayStation } [BepInPlugin("dev.davesco.CorrectControllerIcon", "CorrectControllerIcon", "0.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string modGUID = "dev.davesco.CorrectControllerIcon"; public const string modName = "CorrectControllerIcon"; public const string modVersion = "0.1.0"; internal static readonly Harmony _harmony = new Harmony("dev.davesco.CorrectControllerIcon"); internal static ManualLogSource mlg = Logger.CreateLogSource("dev.davesco.CorrectControllerIcon"); internal static ConfigEntry<ControllerIcons> Icons; private void Awake() { Icons = ((BaseUnityPlugin)this).Config.Bind<ControllerIcons>("General", "Icons", ControllerIcons.Auto, "Which controller's buttons are shown. Auto leaves it to InputUtils, which sees every controller as Xbox while Steam Input is on. Also set from the top right corner of the keybind menu."); ((BaseUnityPlugin)this).Config.SettingChanged += delegate(object sender, SettingChangedEventArgs args) { if ((object)args.ChangedSetting == Icons) { RebindButton.ReloadGlyphs(); IconChoice.UpdateLabel(); } }; mlg.LogInfo((object)"Plugin CorrectControllerIcon is loaded!"); _harmony.PatchAll(); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "CorrectControllerIcon"; public const string PLUGIN_NAME = "CorrectControllerIcon"; public const string PLUGIN_VERSION = "0.1.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }