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 HDPlus v1.2.0
happyness.hdplus.dll
Decompiled 4 days agousing System; using System.Collections; 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 GameNetcodeStuff; using HDPlus.Patches; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("happyness.hdplus")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0")] [assembly: AssemblyProduct("HDPlus")] [assembly: AssemblyTitle("happyness.hdplus")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.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 HDPlus { [BepInPlugin("happyness.hdplus", "HDPlus", "1.2.0")] internal class Plugin : BaseUnityPlugin { public static Plugin Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } public static ConfigEntry<int> ResValue { get; private set; } public static ConfigEntry<int> UWResValue { get; private set; } public static ConfigEntry<bool> UWEnabled { get; private set; } private void Awake() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown Instance = this; Logger = ((BaseUnityPlugin)this).Logger; ResValue = ((BaseUnityPlugin)this).Config.Bind<int>("Resolution", "Index:", 0, "Presets. 0=860x520 (vanilla), 1=1280x720, 2=1920x1080, 3=2560x1440, 4=3840x2160"); UWEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Ultrawide", "Enabled", false, "Enable 21:9 ultrawide support."); UWResValue = ((BaseUnityPlugin)this).Config.Bind<int>("Ultrawide", "Index", 0, "Ultrawide presets. 0=860x520 (vanilla), 1=2560x1080, 2=3440x1440"); if (Harmony == null) { Harmony = new Harmony("happyness.hdplus"); } Harmony.PatchAll(typeof(ResolutionPatch)); Logger.LogInfo((object)"happyness.hdplus v1.2.0 has loaded!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "happyness.hdplus"; public const string PLUGIN_NAME = "HDPlus"; public const string PLUGIN_VERSION = "1.2.0"; } } namespace HDPlus.Patches { internal class ResolutionPatch { [CompilerGenerated] private sealed class <inject>d__63 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IngamePlayerSettings instance; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <inject>d__63(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = null; <>1__state = 2; return true; case 2: <>1__state = -1; Injectbutton(instance); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static readonly (int width, int height, string label)[] Presets = new(int, int, string)[5] { (860, 520, "Vanilla"), (1280, 720, "1280x720"), (1920, 1080, "1920x1080"), (2560, 1440, "2560x1440"), (3840, 2160, "3840x2160") }; public static readonly (int width, int height, string label)[] UWPresets = new(int, int, string)[3] { (860, 520, "Vanilla"), (2560, 1080, "2560x1080 (21:9)"), (3440, 1440, "3440x1440 (21:9)") }; private static int _index = -1; private static int _uwIndex = -1; private static bool _previousUWState = false; private static Vector2 oldboxsize = Vector2.zero; private static RectTransform? newboxsize = null; private static float _originalPanelAspect = -1f; private static float _originalHudAspect = -1f; private static float _originalUICamFOV = -1f; private static float _originalGameplayFOV = -1f; private static float _originalHelmetX = -1f; private static Vector2 _originalCanvasRes = Vector2.zero; private static bool _originalsCaptured = false; private static Vector2 _originalInvAnchorMin = Vector2.zero; private static Vector2 _originalInvAnchorMax = Vector2.zero; private static Vector2 _originalInvPivot = Vector2.zero; private static Vector2 _originalInvPos = Vector2.zero; private static int _originalTerminalWidth = -1; private static int _originalTerminalHeight = -1; private static float _preUWPanelAspect = -1f; private static bool _preUWPanelEnabled = false; private static float _preUWHudAspect = -1f; private static float _preUWUICamFOV = -1f; private static float _preUWGameplayFOV = -1f; private static float _preUWHelmetX = -1f; private static Vector2 _preUWCanvasRes = Vector2.zero; private static Vector2 _preUWInvAnchorMin = Vector2.zero; private static Vector2 _preUWInvAnchorMax = Vector2.zero; private static Vector2 _preUWInvPivot = Vector2.zero; private static Vector2 _preUWInvPos = Vector2.zero; private static int _preUWTerminalWidth = -1; private static int _preUWTerminalHeight = -1; private static AspectRatioFitter? _panel = null; private static CanvasScaler? _canvas = null; private static Camera? _camera = null; private static RectTransform? _invrect = null; private static Transform? _helmet = null; private static Terminal? _terminal = null; private static AspectRatioFitter? _hud = null; private static int Indexx { get { if (_index == -1) { _index = Mathf.Clamp(Plugin.ResValue.Value, 0, Presets.Length - 1); } return _index; } set { _index = Mathf.Clamp(value, 0, Presets.Length - 1); } } private static int UWIndex { get { if (_uwIndex == -1) { _uwIndex = Mathf.Clamp(Plugin.UWResValue.Value, 0, UWPresets.Length - 1); } return _uwIndex; } set { _uwIndex = Mathf.Clamp(value, 0, UWPresets.Length - 1); } } private static bool UWOn => Plugin.UWEnabled.Value; private static (int width, int height, string label) ActivePreset => UWOn ? UWPresets[UWIndex] : Presets[Indexx]; private static float ActiveAspect => (float)ActivePreset.width / (float)ActivePreset.height; private static bool IsVanilla => !UWOn && Indexx == 0; private static void applyres(RenderTexture rt) { if (!((Object)(object)rt == (Object)null)) { var (num, num2, _) = ActivePreset; if (((Texture)rt).width != num || ((Texture)rt).height != num2) { rt.Release(); ((Texture)rt).width = num; ((Texture)rt).height = num2; } } } private static void ApplyRes() { if ((Object)(object)IngamePlayerSettings.Instance?.playerGameplayScreenTex != (Object)null) { applyres(IngamePlayerSettings.Instance.playerGameplayScreenTex); } PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>(); PlayerControllerB[] array2 = array; foreach (PlayerControllerB val in array2) { Camera gameplayCamera = val.gameplayCamera; if ((Object)(object)((gameplayCamera != null) ? gameplayCamera.targetTexture : null) != (Object)null) { applyres(val.gameplayCamera.targetTexture); } } if (UWOn && !_previousUWState) { UWStuff(); } else if (!UWOn && _previousUWState) { ResetAspect(); } _previousUWState = UWOn; } private static void UWStuff() { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) CacheReferences(); SavePreUWState(); float activeAspect = ActiveAspect; Camera val = GameNetworkManager.Instance?.localPlayerController?.gameplayCamera; if (val != null) { val.ResetAspect(); } if ((Object)(object)val != (Object)null) { val.fieldOfView = Mathf.Min(106f / activeAspect, 60f); } if ((Object)(object)_panel != (Object)null) { ((Behaviour)_panel).enabled = true; _panel.aspectRatio = activeAspect; } if ((Object)(object)_canvas != (Object)null) { _canvas.referenceResolution = new Vector2(500f * activeAspect, 500f); } HUDManager instance = HUDManager.Instance; if ((Object)(object)instance != (Object)null) { if ((Object)(object)_terminal?.playerScreenTexHighRes != (Object)null) { RenderTexture playerScreenTexHighRes = _terminal.playerScreenTexHighRes; playerScreenTexHighRes.Release(); ((Texture)playerScreenTexHighRes).height = 580; ((Texture)playerScreenTexHighRes).width = Convert.ToInt32(580f * activeAspect); } if ((Object)(object)_hud != (Object)null) { _hud.aspectRatio = activeAspect; } if ((Object)(object)_camera != (Object)null) { _camera.fieldOfView = Mathf.Min(106f / activeAspect, 60f); } if ((Object)(object)_invrect != (Object)null) { _invrect.anchoredPosition = Vector2.zero; _invrect.anchorMax = new Vector2(0.5f, 0f); _invrect.anchorMin = new Vector2(0.5f, 0.5f); _invrect.pivot = new Vector2(0.5f, 0f); } if ((Object)(object)_helmet != (Object)null) { Vector3 localScale = _helmet.localScale; localScale.x = 0.3628f * Mathf.Max(activeAspect / 2.3f, 1f); _helmet.localScale = localScale; } } } private static void SavePreUWState() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) CacheReferences(); if ((Object)(object)_panel != (Object)null) { _preUWPanelAspect = _panel.aspectRatio; _preUWPanelEnabled = ((Behaviour)_panel).enabled; } if ((Object)(object)_canvas != (Object)null) { _preUWCanvasRes = _canvas.referenceResolution; } if ((Object)(object)_hud != (Object)null) { _preUWHudAspect = _hud.aspectRatio; } if ((Object)(object)_camera != (Object)null) { _preUWUICamFOV = _camera.fieldOfView; } Camera val = GameNetworkManager.Instance?.localPlayerController?.gameplayCamera; if ((Object)(object)val != (Object)null) { _preUWGameplayFOV = val.fieldOfView; } if ((Object)(object)_helmet != (Object)null) { _preUWHelmetX = _helmet.localScale.x; } if ((Object)(object)_invrect != (Object)null) { _preUWInvAnchorMin = _invrect.anchorMin; _preUWInvAnchorMax = _invrect.anchorMax; _preUWInvPivot = _invrect.pivot; _preUWInvPos = _invrect.anchoredPosition; } if ((Object)(object)_terminal?.playerScreenTexHighRes != (Object)null) { _preUWTerminalWidth = ((Texture)_terminal.playerScreenTexHighRes).width; _preUWTerminalHeight = ((Texture)_terminal.playerScreenTexHighRes).height; } } private static void ResetAspect() { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) CacheReferences(); if (!_originalsCaptured) { return; } Camera val = GameNetworkManager.Instance?.localPlayerController?.gameplayCamera; if ((Object)(object)val != (Object)null) { val.fieldOfView = _originalGameplayFOV; val.ResetAspect(); } if ((Object)(object)_panel != (Object)null) { _panel.aspectRatio = _originalPanelAspect; ((Behaviour)_panel).enabled = !IsVanilla; } if ((Object)(object)_canvas != (Object)null) { _canvas.referenceResolution = _originalCanvasRes; } HUDManager instance = HUDManager.Instance; if ((Object)(object)instance != (Object)null) { if ((Object)(object)_terminal?.playerScreenTexHighRes != (Object)null && _originalTerminalWidth > 0 && _originalTerminalHeight > 0) { RenderTexture playerScreenTexHighRes = _terminal.playerScreenTexHighRes; playerScreenTexHighRes.Release(); ((Texture)playerScreenTexHighRes).width = _originalTerminalWidth; ((Texture)playerScreenTexHighRes).height = _originalTerminalHeight; } if ((Object)(object)_hud != (Object)null) { _hud.aspectRatio = _originalHudAspect; } if ((Object)(object)_camera != (Object)null) { _camera.fieldOfView = _originalUICamFOV; } if ((Object)(object)_invrect != (Object)null) { _invrect.anchorMin = _originalInvAnchorMin; _invrect.anchorMax = _originalInvAnchorMax; _invrect.pivot = _originalInvPivot; _invrect.anchoredPosition = _originalInvPos; } if ((Object)(object)_helmet != (Object)null) { Vector3 localScale = _helmet.localScale; localScale.x = _originalHelmetX; _helmet.localScale = localScale; } } } private static void CacheReferences() { if ((Object)(object)_panel == (Object)null) { GameObject val = GameObject.Find("Systems/UI/Canvas/Panel"); if (val != null) { val.TryGetComponent<AspectRatioFitter>(ref _panel); } } if ((Object)(object)_canvas == (Object)null) { GameObject val2 = GameObject.Find("Systems/UI/Canvas"); if (val2 != null) { val2.TryGetComponent<CanvasScaler>(ref _canvas); } } if ((Object)(object)_camera == (Object)null) { GameObject val3 = GameObject.Find("Systems/UI/UICamera"); if (val3 != null) { val3.TryGetComponent<Camera>(ref _camera); } } if ((Object)(object)_helmet == (Object)null) { GameObject val4 = GameObject.Find("PlayerHUDHelmetModel"); if ((Object)(object)val4 != (Object)null) { _helmet = val4.transform; } } if ((Object)(object)_terminal == (Object)null) { GameObject val5 = GameObject.Find("TerminalScript"); if (val5 != null) { val5.TryGetComponent<Terminal>(ref _terminal); } } if ((Object)(object)_hud == (Object)null && (Object)(object)HUDManager.Instance != (Object)null) { GameObject hUDContainer = HUDManager.Instance.HUDContainer; if (hUDContainer != null) { hUDContainer.TryGetComponent<AspectRatioFitter>(ref _hud); } } if ((Object)(object)_invrect == (Object)null && (Object)(object)HUDManager.Instance != (Object)null) { HUDElement inventory = HUDManager.Instance.Inventory; object invrect; if (inventory == null) { invrect = null; } else { CanvasGroup canvasGroup = inventory.canvasGroup; invrect = ((canvasGroup != null) ? ((Component)canvasGroup).GetComponent<RectTransform>() : null); } _invrect = (RectTransform?)invrect; } } private static void SaveOrigs() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) if (!_originalsCaptured) { CacheReferences(); if ((Object)(object)_panel != (Object)null) { _originalPanelAspect = _panel.aspectRatio; } if ((Object)(object)_canvas != (Object)null) { _originalCanvasRes = _canvas.referenceResolution; } if ((Object)(object)_hud != (Object)null) { _originalHudAspect = _hud.aspectRatio; } if ((Object)(object)_camera != (Object)null) { _originalUICamFOV = _camera.fieldOfView; } Camera val = GameNetworkManager.Instance?.localPlayerController?.gameplayCamera; if ((Object)(object)val != (Object)null) { _originalGameplayFOV = val.fieldOfView; } if ((Object)(object)_helmet != (Object)null) { _originalHelmetX = _helmet.localScale.x; } if ((Object)(object)_invrect != (Object)null) { _originalInvAnchorMin = _invrect.anchorMin; _originalInvAnchorMax = _invrect.anchorMax; _originalInvPivot = _invrect.pivot; _originalInvPos = _invrect.anchoredPosition; } if ((Object)(object)_terminal?.playerScreenTexHighRes != (Object)null) { _originalTerminalWidth = ((Texture)_terminal.playerScreenTexHighRes).width; _originalTerminalHeight = ((Texture)_terminal.playerScreenTexHighRes).height; } _originalsCaptured = (Object)(object)_panel != (Object)null; } } [HarmonyPatch(typeof(PlayerControllerB), "Start")] [HarmonyPostfix] private static void pcb(PlayerControllerB __instance) { if (!((NetworkBehaviour)__instance).IsOwner) { return; } Camera gameplayCamera = __instance.gameplayCamera; if (!((Object)(object)((gameplayCamera != null) ? gameplayCamera.targetTexture : null) == (Object)null)) { SaveOrigs(); applyres(__instance.gameplayCamera.targetTexture); if (UWOn) { UWStuff(); } else { ResetAspect(); } } } [HarmonyPatch(typeof(IngamePlayerSettings), "SetPixelResolution")] [HarmonyPostfix] private static void setres(IngamePlayerSettings __instance) { if (!((Object)(object)__instance.playerGameplayScreenTex == (Object)null)) { applyres(__instance.playerGameplayScreenTex); } } [IteratorStateMachine(typeof(<inject>d__63))] private static IEnumerator inject(IngamePlayerSettings instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <inject>d__63(0) { instance = instance }; } [HarmonyPatch(typeof(IngamePlayerSettings), "UpdateGameToMatchSettings")] [HarmonyPostfix] private static void update(IngamePlayerSettings __instance) { ((MonoBehaviour)__instance).StartCoroutine(inject(__instance)); } [HarmonyPatch(typeof(IngamePlayerSettings), "SaveChangedSettings")] [HarmonyPostfix] private static void save() { if (UWOn) { Plugin.UWResValue.Value = UWIndex; } else { Plugin.ResValue.Value = Indexx; } ApplyRes(); } [HarmonyPatch(typeof(IngamePlayerSettings), "DiscardChangedSettings")] [HarmonyPostfix] private static void discard() { if (UWOn) { UWIndex = Mathf.Clamp(Plugin.UWResValue.Value, 0, UWPresets.Length - 1); } else { Indexx = Mathf.Clamp(Plugin.ResValue.Value, 0, Presets.Length - 1); } Refreshelement(); } private static void Injectbutton(IngamePlayerSettings instance) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Expected O, but got Unknown //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_0600: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Expected O, but got Unknown //IL_0631: Unknown result type (might be due to invalid IL or missing references) //IL_0648: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Unknown result type (might be due to invalid IL or missing references) //IL_0662: Unknown result type (might be due to invalid IL or missing references) //IL_06ac: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Expected O, but got Unknown //IL_06dd: Unknown result type (might be due to invalid IL or missing references) //IL_06f4: Unknown result type (might be due to invalid IL or missing references) //IL_0701: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0738: Unknown result type (might be due to invalid IL or missing references) //IL_0751: Unknown result type (might be due to invalid IL or missing references) //IL_0758: Expected O, but got Unknown //IL_0778: Unknown result type (might be due to invalid IL or missing references) //IL_0785: Unknown result type (might be due to invalid IL or missing references) //IL_0792: Unknown result type (might be due to invalid IL or missing references) //IL_07dc: Unknown result type (might be due to invalid IL or missing references) //IL_07e3: Expected O, but got Unknown //IL_080d: Unknown result type (might be due to invalid IL or missing references) //IL_0824: Unknown result type (might be due to invalid IL or missing references) //IL_0831: Unknown result type (might be due to invalid IL or missing references) //IL_083e: Unknown result type (might be due to invalid IL or missing references) //IL_08a3: Unknown result type (might be due to invalid IL or missing references) //IL_08aa: Expected O, but got Unknown //IL_08d4: Unknown result type (might be due to invalid IL or missing references) //IL_08eb: Unknown result type (might be due to invalid IL or missing references) //IL_08f8: Unknown result type (might be due to invalid IL or missing references) //IL_0905: Unknown result type (might be due to invalid IL or missing references) //IL_092f: Unknown result type (might be due to invalid IL or missing references) //IL_0948: Unknown result type (might be due to invalid IL or missing references) //IL_094f: Expected O, but got Unknown //IL_096f: Unknown result type (might be due to invalid IL or missing references) //IL_097c: Unknown result type (might be due to invalid IL or missing references) //IL_0989: Unknown result type (might be due to invalid IL or missing references) //IL_09dc: Unknown result type (might be due to invalid IL or missing references) //IL_09e6: Expected O, but got Unknown //IL_09f5: Unknown result type (might be due to invalid IL or missing references) //IL_09ff: Expected O, but got Unknown //IL_0a05: Unknown result type (might be due to invalid IL or missing references) //IL_0a0c: Expected O, but got Unknown //IL_0ac6: Unknown result type (might be due to invalid IL or missing references) //IL_0add: Unknown result type (might be due to invalid IL or missing references) //IL_0af4: Unknown result type (might be due to invalid IL or missing references) //IL_0b0b: Unknown result type (might be due to invalid IL or missing references) //IL_0b22: Unknown result type (might be due to invalid IL or missing references) //IL_0a40: Unknown result type (might be due to invalid IL or missing references) //IL_0a4f: Unknown result type (might be due to invalid IL or missing references) //IL_0a5e: Unknown result type (might be due to invalid IL or missing references) //IL_0a6d: Unknown result type (might be due to invalid IL or missing references) //IL_0a7c: Unknown result type (might be due to invalid IL or missing references) //IL_0a88: Unknown result type (might be due to invalid IL or missing references) //IL_0a94: Unknown result type (might be due to invalid IL or missing references) //IL_0aab: Unknown result type (might be due to invalid IL or missing references) //IL_0b33: Unknown result type (might be due to invalid IL or missing references) //IL_0b3a: Expected O, but got Unknown //IL_0b64: Unknown result type (might be due to invalid IL or missing references) //IL_0b7b: Unknown result type (might be due to invalid IL or missing references) //IL_0b88: Unknown result type (might be due to invalid IL or missing references) //IL_0b95: Unknown result type (might be due to invalid IL or missing references) //IL_0bdf: Unknown result type (might be due to invalid IL or missing references) //IL_0be6: Expected O, but got Unknown //IL_0c10: Unknown result type (might be due to invalid IL or missing references) //IL_0c27: Unknown result type (might be due to invalid IL or missing references) //IL_0c3e: Unknown result type (might be due to invalid IL or missing references) //IL_0c4b: Unknown result type (might be due to invalid IL or missing references) //IL_0c58: Unknown result type (might be due to invalid IL or missing references) //IL_0ce2: Unknown result type (might be due to invalid IL or missing references) //IL_0ce9: Expected O, but got Unknown //IL_0d09: Unknown result type (might be due to invalid IL or missing references) //IL_0d16: Unknown result type (might be due to invalid IL or missing references) //IL_0d23: Unknown result type (might be due to invalid IL or missing references) //IL_0cb8: Unknown result type (might be due to invalid IL or missing references) //IL_0d9d: Unknown result type (might be due to invalid IL or missing references) //IL_0da7: Expected O, but got Unknown //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)newboxsize != (Object)null && ((object)newboxsize).Equals((object?)null)) { newboxsize = null; oldboxsize = Vector2.zero; } (int, int, string)[] array = (UWOn ? UWPresets : Presets); int num = (UWOn ? UWIndex : Indexx); Reselement[] array2 = Object.FindObjectsOfType<Reselement>(true); if (array2 != null && array2.Length != 0) { Reselement[] array3 = array2; foreach (Reselement reselement in array3) { Transform val = ((Component)reselement).transform.Find("Value"); if ((Object)(object)val != (Object)null) { TextMeshProUGUI component = ((Component)val).GetComponent<TextMeshProUGUI>(); if ((Object)(object)component != (Object)null) { ((TMP_Text)component).text = array[num].Item3; } } Transform val2 = ((Component)reselement).transform.Find("Checkbox/Text"); if ((Object)(object)val2 != (Object)null) { TextMeshProUGUI component2 = ((Component)val2).GetComponent<TextMeshProUGUI>(); if ((Object)(object)component2 != (Object)null) { ((TMP_Text)component2).text = (Plugin.UWEnabled.Value ? "x" : ""); } } } return; } SettingsOption[] array4 = Object.FindObjectsOfType<SettingsOption>(true); if (array4 == null || array4.Length == 0) { return; } Transform val3 = null; Transform[] array5 = Object.FindObjectsOfType<Transform>(true); Transform[] array6 = array5; foreach (Transform val4 in array6) { if (((Object)val4).name == "SettingsPanel") { Transform parent = val4.parent; if (((parent != null) ? ((Object)parent).name : null) == "QuickMenu") { val3 = val4; break; } } } if ((Object)(object)val3 == (Object)null) { val3 = ((Component)array4[^1]).transform.parent; } if ((Object)(object)val3 == (Object)null) { return; } GameObject val5 = new GameObject("menuelement"); val5.transform.SetParent(val3, false); val5.AddComponent<Reselement>(); for (int k = 0; k < val3.childCount; k++) { if (((Object)val3.GetChild(k)).name == "PixelRes") { val5.transform.SetSiblingIndex(k + 1); break; } } Transform obj = val3.Find("PixelRes"); RectTransform val6 = ((obj != null) ? ((Component)obj).GetComponent<RectTransform>() : null); RectTransform val7 = val5.AddComponent<RectTransform>(); Image val8 = val5.AddComponent<Image>(); Transform obj2 = val3.Find("PixelRes"); GameObject val9 = ((obj2 != null) ? ((Component)obj2).gameObject : null); if ((Object)(object)val9 != (Object)null) { Image componentInChildren = val9.GetComponentInChildren<Image>(); if ((Object)(object)componentInChildren != (Object)null) { val8.sprite = componentInChildren.sprite; val8.type = (Type)1; val8.fillCenter = true; ((Graphic)val8).color = ((Graphic)componentInChildren).color; val8.pixelsPerUnitMultiplier = componentInChildren.pixelsPerUnitMultiplier; } } else { ((Graphic)val8).color = new Color(0.1f, 0.1f, 0.1f, 0.5f); } if ((Object)(object)val6 != (Object)null) { val7.anchorMin = val6.anchorMin; val7.anchorMax = val6.anchorMax; val7.pivot = val6.pivot; val7.sizeDelta = val6.sizeDelta; val7.anchoredPosition = new Vector2(val6.anchoredPosition.x, val6.anchoredPosition.y - val6.sizeDelta.y * 2f - 10f); } else { val7.anchorMin = new Vector2(0.5f, 0.5f); val7.anchorMax = new Vector2(0.5f, 0.5f); val7.pivot = new Vector2(0.5f, 0.5f); val7.sizeDelta = new Vector2(184f, 30f); val7.anchoredPosition = Vector2.zero; } if ((Object)(object)newboxsize == (Object)null) { Transform[] array7 = Object.FindObjectsOfType<Transform>(true); Transform[] array8 = array7; foreach (Transform val10 in array8) { if (!(((Object)val10).name == "Graphics")) { continue; } Transform parent2 = val10.parent; if ((Object)(object)parent2 == (Object)null) { break; } bool flag = false; for (int m = 0; m < parent2.childCount; m++) { Transform child = parent2.GetChild(m); if (((Object)child).name == "Graphics") { flag = true; } else if (flag && ((Object)child).name.StartsWith("BoxFrame")) { newboxsize = ((Component)child).GetComponent<RectTransform>(); if ((Object)(object)newboxsize != (Object)null && (Object)(object)val6 != (Object)null) { oldboxsize = newboxsize.sizeDelta; float num2 = val6.sizeDelta.y * 2f + 7f; newboxsize.sizeDelta = new Vector2(oldboxsize.x, oldboxsize.y + num2); newboxsize.anchoredPosition = new Vector2(newboxsize.anchoredPosition.x, newboxsize.anchoredPosition.y - num2 / 2f); } break; } } break; } } GameObject val11 = new GameObject("Label"); val11.transform.SetParent(val5.transform, false); RectTransform val12 = val11.AddComponent<RectTransform>(); val12.anchorMin = new Vector2(0.03f, 0f); val12.anchorMax = new Vector2(0.4f, 1f); val12.sizeDelta = Vector2.zero; val12.anchoredPosition = Vector2.zero; TextMeshProUGUI val13 = val11.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val13).text = "Resolution"; ((TMP_Text)val13).fontSize = 13f; ((TMP_Text)val13).alignment = (TextAlignmentOptions)4097; font(val13, array4); GameObject val14 = new GameObject("ButtonLeft"); val14.transform.SetParent(val5.transform, false); RectTransform val15 = val14.AddComponent<RectTransform>(); val15.anchorMin = new Vector2(0.44f, 0.1f); val15.anchorMax = new Vector2(0.55f, 0.9f); val15.sizeDelta = Vector2.zero; val15.anchoredPosition = Vector2.zero; Image val16 = val14.AddComponent<Image>(); ((Graphic)val16).color = new Color(0.2f, 0.2f, 0.2f, 0.8f); Button val17 = val14.AddComponent<Button>(); GameObject val18 = new GameObject("Text"); val18.transform.SetParent(val14.transform, false); RectTransform val19 = val18.AddComponent<RectTransform>(); val19.anchorMin = Vector2.zero; val19.anchorMax = Vector2.one; val19.sizeDelta = Vector2.zero; TextMeshProUGUI val20 = val18.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val20).text = "<"; ((TMP_Text)val20).fontSize = 16f; ((TMP_Text)val20).alignment = (TextAlignmentOptions)514; font(val20, array4); GameObject val21 = new GameObject("Value"); val21.transform.SetParent(val5.transform, false); RectTransform val22 = val21.AddComponent<RectTransform>(); val22.anchorMin = new Vector2(0.55f, 0f); val22.anchorMax = new Vector2(0.86f, 1f); val22.sizeDelta = Vector2.zero; val22.anchoredPosition = Vector2.zero; TextMeshProUGUI valueText = val21.AddComponent<TextMeshProUGUI>(); ((TMP_Text)valueText).text = array[num].Item3; ((TMP_Text)valueText).fontSize = 11f; ((TMP_Text)valueText).alignment = (TextAlignmentOptions)514; font(valueText, array4); GameObject val23 = new GameObject("ButtonRight"); val23.transform.SetParent(val5.transform, false); RectTransform val24 = val23.AddComponent<RectTransform>(); val24.anchorMin = new Vector2(0.87f, 0.1f); val24.anchorMax = new Vector2(0.98f, 0.9f); val24.sizeDelta = Vector2.zero; val24.anchoredPosition = Vector2.zero; Image val25 = val23.AddComponent<Image>(); ((Graphic)val25).color = new Color(0.2f, 0.2f, 0.2f, 0.8f); Button val26 = val23.AddComponent<Button>(); GameObject val27 = new GameObject("Text"); val27.transform.SetParent(val23.transform, false); RectTransform val28 = val27.AddComponent<RectTransform>(); val28.anchorMin = Vector2.zero; val28.anchorMax = Vector2.one; val28.sizeDelta = Vector2.zero; TextMeshProUGUI val29 = val27.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val29).text = ">"; ((TMP_Text)val29).fontSize = 16f; ((TMP_Text)val29).alignment = (TextAlignmentOptions)514; font(val29, array4); ((UnityEvent)val17.onClick).AddListener((UnityAction)delegate { if (UWOn) { UWIndex = (UWIndex - 1 + UWPresets.Length) % UWPresets.Length; ((TMP_Text)valueText).text = UWPresets[UWIndex].label; } else { Indexx = (Indexx - 1 + Presets.Length) % Presets.Length; ((TMP_Text)valueText).text = Presets[Indexx].label; } IngamePlayerSettings.Instance.changesNotApplied = true; }); ((UnityEvent)val26.onClick).AddListener((UnityAction)delegate { if (UWOn) { UWIndex = (UWIndex + 1) % UWPresets.Length; ((TMP_Text)valueText).text = UWPresets[UWIndex].label; } else { Indexx = (Indexx + 1) % Presets.Length; ((TMP_Text)valueText).text = Presets[Indexx].label; } IngamePlayerSettings.Instance.changesNotApplied = true; }); GameObject val30 = new GameObject("menuToggle"); val30.transform.SetParent(val3, false); val30.AddComponent<Reselement>(); RectTransform val31 = val30.AddComponent<RectTransform>(); if ((Object)(object)val6 != (Object)null) { val31.anchorMin = val6.anchorMin; val31.anchorMax = val6.anchorMax; val31.pivot = val6.pivot; val31.sizeDelta = val6.sizeDelta; val31.anchoredPosition = new Vector2(val6.anchoredPosition.x, val6.anchoredPosition.y - val6.sizeDelta.y * 2f - 40f); } else { val31.anchorMin = new Vector2(0.5f, 0.5f); val31.anchorMax = new Vector2(0.5f, 0.5f); val31.pivot = new Vector2(0.5f, 0.5f); val31.sizeDelta = new Vector2(184f, 30f); val31.anchoredPosition = new Vector2(0f, -125f); } GameObject val32 = new GameObject("Label"); val32.transform.SetParent(val30.transform, false); RectTransform val33 = val32.AddComponent<RectTransform>(); val33.anchorMin = new Vector2(0.03f, 0f); val33.anchorMax = new Vector2(0.6f, 1f); val33.sizeDelta = Vector2.zero; val33.anchoredPosition = Vector2.zero; TextMeshProUGUI val34 = val32.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val34).text = "Enable ultrawide"; ((TMP_Text)val34).fontSize = 13f; ((TMP_Text)val34).alignment = (TextAlignmentOptions)4097; font(val34, array4); GameObject val35 = new GameObject("Checkbox"); val35.transform.SetParent(val30.transform, false); RectTransform val36 = val35.AddComponent<RectTransform>(); val36.anchorMin = new Vector2(0.85f, 0.2f); val36.anchorMax = new Vector2(0.95f, 0.8f); val36.pivot = new Vector2(0.5f, 0.5f); val36.sizeDelta = Vector2.zero; val36.anchoredPosition = Vector2.zero; Image val37 = val35.AddComponent<Image>(); if ((Object)(object)val9 != (Object)null) { Image componentInChildren2 = val9.GetComponentInChildren<Image>(); if ((Object)(object)componentInChildren2 != (Object)null) { val37.sprite = componentInChildren2.sprite; val37.type = (Type)1; val37.fillCenter = true; ((Graphic)val37).color = ((Graphic)componentInChildren2).color; val37.pixelsPerUnitMultiplier = componentInChildren2.pixelsPerUnitMultiplier; } } Button val38 = val35.AddComponent<Button>(); GameObject val39 = new GameObject("Text"); val39.transform.SetParent(val35.transform, false); RectTransform val40 = val39.AddComponent<RectTransform>(); val40.anchorMin = Vector2.zero; val40.anchorMax = Vector2.one; val40.sizeDelta = Vector2.zero; TextMeshProUGUI toggleButtonText = val39.AddComponent<TextMeshProUGUI>(); ((TMP_Text)toggleButtonText).text = (Plugin.UWEnabled.Value ? "x" : ""); ((TMP_Text)toggleButtonText).fontSize = 16f; ((TMP_Text)toggleButtonText).alignment = (TextAlignmentOptions)514; font(toggleButtonText, array4); ((UnityEvent)val38.onClick).AddListener((UnityAction)delegate { Plugin.UWEnabled.Value = !Plugin.UWEnabled.Value; ((TMP_Text)toggleButtonText).text = (Plugin.UWEnabled.Value ? "x" : ""); ApplyRes(); Refreshelement(); }); } private static void Refreshelement() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) Reselement[] array = Object.FindObjectsOfType<Reselement>(true); if (array == null || array.Length == 0) { newboxsize = null; oldboxsize = Vector2.zero; return; } Reselement[] array2 = array; foreach (Reselement reselement in array2) { Transform val = ((Component)reselement).transform.Find("Value"); if ((Object)(object)val != (Object)null) { TextMeshProUGUI component = ((Component)val).GetComponent<TextMeshProUGUI>(); if ((Object)(object)component != (Object)null) { ((TMP_Text)component).text = (UWOn ? UWPresets[UWIndex].label : Presets[Indexx].label); } } Transform val2 = ((Component)reselement).transform.Find("Checkbox/Text"); if ((Object)(object)val2 != (Object)null) { TextMeshProUGUI component2 = ((Component)val2).GetComponent<TextMeshProUGUI>(); if ((Object)(object)component2 != (Object)null) { ((TMP_Text)component2).text = (Plugin.UWEnabled.Value ? "x" : ""); } } } } private static void font(TextMeshProUGUI target, SettingsOption[] options) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) foreach (SettingsOption val in options) { TextMeshProUGUI componentInChildren = ((Component)val).GetComponentInChildren<TextMeshProUGUI>(); if ((Object)(object)componentInChildren != (Object)null) { ((TMP_Text)target).font = ((TMP_Text)componentInChildren).font; ((Graphic)target).color = ((Graphic)componentInChildren).color; break; } } } [HarmonyPatch(typeof(HUDManager), "UpdateScanNodes")] [HarmonyPostfix] private static void scannodes(PlayerControllerB playerScript, HUDManager __instance, Dictionary<RectTransform, ScanNodeProperties> ___scanNodes) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if (!UWOn) { return; } RectTransform[] scanElements = __instance.scanElements; GameObject gameObject = ((Component)__instance.playerScreenTexture).gameObject; RectTransform val = default(RectTransform); if (!gameObject.TryGetComponent<RectTransform>(ref val)) { return; } Rect rect = val.rect; for (int i = 0; i < scanElements.Length; i++) { if (___scanNodes.TryGetValue(scanElements[i], out ScanNodeProperties value)) { Vector3 val2 = playerScript.gameplayCamera.WorldToViewportPoint(((Component)value).transform.position); scanElements[i].anchoredPosition = new Vector2(((Rect)(ref rect)).xMin + ((Rect)(ref rect)).width * val2.x, ((Rect)(ref rect)).yMin + ((Rect)(ref rect)).height * val2.y); } } } } internal class Reselement : MonoBehaviour { } }