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 NintendoButtonSwap v1.0.1
NintendoButtonSwap.dll
Decompiled a day agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; 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("NintendoButtonSwap")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NintendoButtonSwap")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("5b528fca-84dd-4954-a975-a632fcd4e548")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("com.ezat.nintendobuttonswap", "Nintendo Button Swap", "1.0.0")] public class NintendoButtonSwap : BaseUnityPlugin { private bool found; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Nintendo Button Swap gestartet."); ((MonoBehaviour)this).StartCoroutine(FindTexture()); } private IEnumerator FindTexture() { string dllPath = Assembly.GetExecutingAssembly().Location; string pluginFolder = Path.GetDirectoryName(dllPath); string pngPath = Path.Combine(pluginFolder, "switch2.png"); if (!File.Exists(pngPath)) { ((BaseUnityPlugin)this).Logger.LogError((object)("PNG nicht gefunden: " + pngPath)); yield break; } byte[] pngBytes = File.ReadAllBytes(pngPath); ((BaseUnityPlugin)this).Logger.LogInfo((object)("PNG gefunden: " + pngPath)); for (int attempt = 0; attempt < 90; attempt++) { Texture2D[] textures = Resources.FindObjectsOfTypeAll<Texture2D>(); Texture2D[] array = textures; foreach (Texture2D texture in array) { if ((Object)(object)texture == (Object)null || !string.Equals(((Object)texture).name, "switch2", StringComparison.OrdinalIgnoreCase)) { continue; } found = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Textur gefunden: " + ((Object)texture).name + " (" + ((Texture)texture).width + "x" + ((Texture)texture).height + ")")); MethodInfo loadImage = typeof(ImageConversion).GetMethod("LoadImage", BindingFlags.Static | BindingFlags.Public, null, new Type[3] { typeof(Texture2D), typeof(byte[]), typeof(bool) }, null); if (loadImage == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"LoadImage-Methode nicht gefunden."); yield break; } try { if ((bool)loadImage.Invoke(null, new object[3] { texture, pngBytes, false })) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"PNG erfolgreich geladen!"); } else { ((BaseUnityPlugin)this).Logger.LogError((object)"PNG konnte nicht geladen werden."); } yield break; } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Fehler beim Texturersatz: " + ex)); yield break; } } yield return (object)new WaitForSeconds(2f); } if (!found) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Textur switch2 wurde nicht gefunden."); } } }