Please disclose if your mod was created primarily 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 kruumys FixResolution v1.0.0
FixResolution.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using GameNetcodeStuff; using HarmonyLib; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("FixResolution")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FixResolution")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e2208386-f58f-4318-bb88-ae3ecb7247f4")] [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 FixResolution; [BepInPlugin("kruumy.FixResolution", "Fix Resolution", "1.0.0")] public class Main : BaseUnityPlugin { private void Awake() { Harmony.CreateAndPatchAll(typeof(Main), (string)null); SceneManager.activeSceneChanged += SceneManager_activeSceneChanged; } private void SceneManager_activeSceneChanged(Scene arg0, Scene arg1) { Object[] array = Object.FindObjectsOfTypeAll(typeof(Camera)); foreach (Object obj in array) { Camera val = (Camera)(object)((obj is Camera) ? obj : null); if (val != null && ((Object)val).name == "MainCamera") { val.targetTexture = val.targetTexture; } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] private static void TargetTexturePrefix(Camera __instance, ref RenderTexture __0) { if ((Object)(object)__0 != (Object)null && (((Texture)__0).width != Screen.width || ((Texture)__0).height != Screen.height)) { __instance.targetTexture = null; __0.Release(); ((Texture)__0).width = Screen.width; ((Texture)__0).height = Screen.height; __0.Create(); } } [HarmonyPatch(typeof(HUDManager), "UpdateScanNodes", new Type[] { typeof(PlayerControllerB) })] [HarmonyPostfix] private static void UpdateScanNodesPostfix(HUDManager __instance, PlayerControllerB playerScript) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) Dictionary<RectTransform, ScanNodeProperties> dictionary = (Dictionary<RectTransform, ScanNodeProperties>)typeof(HUDManager).GetField("scanNodes", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); RectTransform[] scanElements = __instance.scanElements; foreach (RectTransform val in scanElements) { if (dictionary.TryGetValue(val, out var value)) { Vector3 val2 = playerScript.gameplayCamera.WorldToScreenPoint(((Component)value).transform.position); val.anchoredPosition = new Vector2((val2.x - (float)(Screen.width / 2)) / 2f, (val2.y - (float)(Screen.height / 2)) / 2f); } } } }