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.1
happyness.hdplus.dll
Decompiled a month 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 Dissonance; 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.1.0")] [assembly: AssemblyInformationalVersion("1.2.1")] [assembly: AssemblyProduct("HDPlus")] [assembly: AssemblyTitle("happyness.hdplus")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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.1")] 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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"); Logs.SetLogLevel((LogCategory)1, (LogLevel)4); Logs.SetLogLevel((LogCategory)3, (LogLevel)4); Logs.SetLogLevel((LogCategory)2, (LogLevel)4); if (Harmony == null) { Harmony = new Harmony("happyness.hdplus"); } Harmony.PatchAll(typeof(ResolutionPatch)); Harmony.PatchAll(typeof(RPCLag)); Logger.LogInfo((object)"happyness.hdplus v1.2.1 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.1"; } } namespace HDPlus.Patches { internal class ResolutionPatch { 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 bool _preUWStateSaved = false; 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; } _preUWStateSaved = true; } 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) { 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); } } private static IEnumerator inject(IngamePlayerSettings instance) { yield return null; yield return null; Injectbutton(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_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Expected O, but got Unknown //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_059a: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Expected O, but got Unknown //IL_0622: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_067d: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Unknown result type (might be due to invalid IL or missing references) //IL_069d: Expected O, but got Unknown //IL_06bd: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: Unknown result type (might be due to invalid IL or missing references) //IL_06d7: Unknown result type (might be due to invalid IL or missing references) //IL_0721: Unknown result type (might be due to invalid IL or missing references) //IL_0728: Expected O, but got Unknown //IL_0752: Unknown result type (might be due to invalid IL or missing references) //IL_0769: Unknown result type (might be due to invalid IL or missing references) //IL_0776: Unknown result type (might be due to invalid IL or missing references) //IL_0783: Unknown result type (might be due to invalid IL or missing references) //IL_07e8: Unknown result type (might be due to invalid IL or missing references) //IL_07ef: Expected O, but got Unknown //IL_0819: Unknown result type (might be due to invalid IL or missing references) //IL_0830: Unknown result type (might be due to invalid IL or missing references) //IL_083d: Unknown result type (might be due to invalid IL or missing references) //IL_084a: Unknown result type (might be due to invalid IL or missing references) //IL_0874: Unknown result type (might be due to invalid IL or missing references) //IL_088d: Unknown result type (might be due to invalid IL or missing references) //IL_0894: Expected O, but got Unknown //IL_08b4: Unknown result type (might be due to invalid IL or missing references) //IL_08c1: Unknown result type (might be due to invalid IL or missing references) //IL_08ce: Unknown result type (might be due to invalid IL or missing references) //IL_0921: Unknown result type (might be due to invalid IL or missing references) //IL_092b: Expected O, but got Unknown //IL_093a: Unknown result type (might be due to invalid IL or missing references) //IL_0944: Expected O, but got Unknown //IL_094a: Unknown result type (might be due to invalid IL or missing references) //IL_0951: Expected O, but got Unknown //IL_0a4c: Unknown result type (might be due to invalid IL or missing references) //IL_0a17: Unknown result type (might be due to invalid IL or missing references) //IL_0af1: Unknown result type (might be due to invalid IL or missing references) //IL_0b08: Unknown result type (might be due to invalid IL or missing references) //IL_0b1f: Unknown result type (might be due to invalid IL or missing references) //IL_0b36: Unknown result type (might be due to invalid IL or missing references) //IL_0b4d: Unknown result type (might be due to invalid IL or missing references) //IL_0a6b: Unknown result type (might be due to invalid IL or missing references) //IL_0a7a: Unknown result type (might be due to invalid IL or missing references) //IL_0a89: Unknown result type (might be due to invalid IL or missing references) //IL_0a98: Unknown result type (might be due to invalid IL or missing references) //IL_0aa7: Unknown result type (might be due to invalid IL or missing references) //IL_0ab3: Unknown result type (might be due to invalid IL or missing references) //IL_0abf: Unknown result type (might be due to invalid IL or missing references) //IL_0ad6: Unknown result type (might be due to invalid IL or missing references) //IL_0b5e: Unknown result type (might be due to invalid IL or missing references) //IL_0b65: Expected O, but got Unknown //IL_0b8f: Unknown result type (might be due to invalid IL or missing references) //IL_0ba6: Unknown result type (might be due to invalid IL or missing references) //IL_0bb3: Unknown result type (might be due to invalid IL or missing references) //IL_0bc0: Unknown result type (might be due to invalid IL or missing references) //IL_0c13: Unknown result type (might be due to invalid IL or missing references) //IL_0c1a: Expected O, but got Unknown //IL_0c44: Unknown result type (might be due to invalid IL or missing references) //IL_0c5b: Unknown result type (might be due to invalid IL or missing references) //IL_0c72: Unknown result type (might be due to invalid IL or missing references) //IL_0c7f: Unknown result type (might be due to invalid IL or missing references) //IL_0c8c: Unknown result type (might be due to invalid IL or missing references) //IL_0d1f: Unknown result type (might be due to invalid IL or missing references) //IL_0d26: Expected O, but got Unknown //IL_0d46: Unknown result type (might be due to invalid IL or missing references) //IL_0d53: Unknown result type (might be due to invalid IL or missing references) //IL_0d60: Unknown result type (might be due to invalid IL or missing references) //IL_0cf5: Unknown result type (might be due to invalid IL or missing references) //IL_0de7: Unknown result type (might be due to invalid IL or missing references) //IL_0df1: Expected O, but got Unknown //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) (int, int, string)[] array = (UWOn ? UWPresets : Presets); int num = (UWOn ? UWIndex : Indexx); Reselement reselement = Object.FindObjectOfType<Reselement>(true); if ((Object)(object)reselement != (Object)null) { 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; } } return; } SettingsOption[] array2 = Object.FindObjectsOfType<SettingsOption>(true); if (array2 == null || array2.Length == 0) { return; } Transform val2 = null; Transform[] array3 = Object.FindObjectsOfType<Transform>(true); Transform[] array4 = array3; foreach (Transform val3 in array4) { if (((Object)val3).name == "SettingsPanel") { Transform parent = val3.parent; if (((parent != null) ? ((Object)parent).name : null) == "QuickMenu") { val2 = val3; break; } } } if ((Object)(object)val2 == (Object)null) { val2 = ((Component)array2[^1]).transform.parent; } if ((Object)(object)val2 == (Object)null) { return; } GameObject val4 = new GameObject("menuelement"); val4.transform.SetParent(val2, false); val4.AddComponent<Reselement>(); for (int j = 0; j < val2.childCount; j++) { if (((Object)val2.GetChild(j)).name == "PixelRes") { val4.transform.SetSiblingIndex(j + 1); break; } } Transform obj = val2.Find("PixelRes"); RectTransform val5 = ((obj != null) ? ((Component)obj).GetComponent<RectTransform>() : null); RectTransform val6 = val4.AddComponent<RectTransform>(); Image val7 = val4.AddComponent<Image>(); Transform obj2 = val2.Find("PixelRes"); GameObject val8 = ((obj2 != null) ? ((Component)obj2).gameObject : null); if ((Object)(object)val8 != (Object)null) { Image componentInChildren = val8.GetComponentInChildren<Image>(); if ((Object)(object)componentInChildren != (Object)null) { val7.sprite = componentInChildren.sprite; val7.type = (Type)1; val7.fillCenter = true; ((Graphic)val7).color = ((Graphic)componentInChildren).color; val7.pixelsPerUnitMultiplier = componentInChildren.pixelsPerUnitMultiplier; } } else { ((Graphic)val7).color = new Color(0.1f, 0.1f, 0.1f, 0.5f); } if ((Object)(object)val5 != (Object)null) { val6.anchorMin = val5.anchorMin; val6.anchorMax = val5.anchorMax; val6.pivot = val5.pivot; val6.sizeDelta = val5.sizeDelta; val6.anchoredPosition = new Vector2(val5.anchoredPosition.x, val5.anchoredPosition.y - val5.sizeDelta.y * 2f - 20f); } else { val6.anchorMin = new Vector2(0.5f, 0.5f); val6.anchorMax = new Vector2(0.5f, 0.5f); val6.pivot = new Vector2(0.5f, 0.5f); val6.sizeDelta = new Vector2(184f, 30f); val6.anchoredPosition = Vector2.zero; } if ((Object)(object)newboxsize == (Object)null) { Transform[] array5 = Object.FindObjectsOfType<Transform>(true); Transform[] array6 = array5; foreach (Transform val9 in array6) { if (!(((Object)val9).name == "Graphics")) { continue; } Transform parent2 = val9.parent; if ((Object)(object)parent2 == (Object)null) { break; } bool flag = false; for (int l = 0; l < parent2.childCount; l++) { Transform child = parent2.GetChild(l); 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)val5 != (Object)null) { oldboxsize = newboxsize.sizeDelta; float num2 = val5.sizeDelta.y * 2f + 27f; newboxsize.sizeDelta = new Vector2(oldboxsize.x, oldboxsize.y + num2); newboxsize.anchoredPosition = new Vector2(newboxsize.anchoredPosition.x, newboxsize.anchoredPosition.y - num2 / 2f); } break; } } break; } } GameObject val10 = new GameObject("Label"); val10.transform.SetParent(val4.transform, false); RectTransform val11 = val10.AddComponent<RectTransform>(); val11.anchorMin = new Vector2(0.03f, 0f); val11.anchorMax = new Vector2(0.4f, 1f); val11.sizeDelta = Vector2.zero; val11.anchoredPosition = Vector2.zero; TextMeshProUGUI val12 = val10.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val12).text = "Resolution"; ((TMP_Text)val12).fontSize = 13f; ((TMP_Text)val12).alignment = (TextAlignmentOptions)4097; font(val12, array2); GameObject val13 = new GameObject("ButtonLeft"); val13.transform.SetParent(val4.transform, false); RectTransform val14 = val13.AddComponent<RectTransform>(); val14.anchorMin = new Vector2(0.44f, 0.1f); val14.anchorMax = new Vector2(0.55f, 0.9f); val14.sizeDelta = Vector2.zero; val14.anchoredPosition = Vector2.zero; Image val15 = val13.AddComponent<Image>(); ((Graphic)val15).color = new Color(0.2f, 0.2f, 0.2f, 0.8f); Button val16 = val13.AddComponent<Button>(); GameObject val17 = new GameObject("Text"); val17.transform.SetParent(val13.transform, false); RectTransform val18 = val17.AddComponent<RectTransform>(); val18.anchorMin = Vector2.zero; val18.anchorMax = Vector2.one; val18.sizeDelta = Vector2.zero; TextMeshProUGUI val19 = val17.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val19).text = "<"; ((TMP_Text)val19).fontSize = 16f; ((TMP_Text)val19).alignment = (TextAlignmentOptions)514; font(val19, array2); GameObject val20 = new GameObject("Value"); val20.transform.SetParent(val4.transform, false); RectTransform val21 = val20.AddComponent<RectTransform>(); val21.anchorMin = new Vector2(0.55f, 0f); val21.anchorMax = new Vector2(0.86f, 1f); val21.sizeDelta = Vector2.zero; val21.anchoredPosition = Vector2.zero; TextMeshProUGUI valueText = val20.AddComponent<TextMeshProUGUI>(); ((TMP_Text)valueText).text = array[num].Item3; ((TMP_Text)valueText).fontSize = 11f; ((TMP_Text)valueText).alignment = (TextAlignmentOptions)514; font(valueText, array2); GameObject val22 = new GameObject("ButtonRight"); val22.transform.SetParent(val4.transform, false); RectTransform val23 = val22.AddComponent<RectTransform>(); val23.anchorMin = new Vector2(0.87f, 0.1f); val23.anchorMax = new Vector2(0.98f, 0.9f); val23.sizeDelta = Vector2.zero; val23.anchoredPosition = Vector2.zero; Image val24 = val22.AddComponent<Image>(); ((Graphic)val24).color = new Color(0.2f, 0.2f, 0.2f, 0.8f); Button val25 = val22.AddComponent<Button>(); GameObject val26 = new GameObject("Text"); val26.transform.SetParent(val22.transform, false); RectTransform val27 = val26.AddComponent<RectTransform>(); val27.anchorMin = Vector2.zero; val27.anchorMax = Vector2.one; val27.sizeDelta = Vector2.zero; TextMeshProUGUI val28 = val26.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val28).text = ">"; ((TMP_Text)val28).fontSize = 16f; ((TMP_Text)val28).alignment = (TextAlignmentOptions)514; font(val28, array2); ((UnityEvent)val16.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)val25.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 val29 = new GameObject("menuToggle"); val29.transform.SetParent(val2, false); val29.AddComponent<Reselement>(); for (int num3 = 0; num3 < val2.childCount; num3++) { if (((Object)val2.GetChild(num3)).name == "PixelRes") { val29.transform.SetSiblingIndex(num3 + 2); break; } } RectTransform val30 = val29.AddComponent<RectTransform>(); Image val31 = val29.AddComponent<Image>(); if ((Object)(object)val8 != (Object)null) { Image componentInChildren2 = val8.GetComponentInChildren<Image>(); if ((Object)(object)componentInChildren2 != (Object)null) { val31.sprite = componentInChildren2.sprite; val31.type = (Type)1; val31.fillCenter = true; ((Graphic)val31).color = ((Graphic)componentInChildren2).color; val31.pixelsPerUnitMultiplier = componentInChildren2.pixelsPerUnitMultiplier; } } else { ((Graphic)val31).color = new Color(0.1f, 0.1f, 0.1f, 0.5f); } if ((Object)(object)val5 != (Object)null) { val30.anchorMin = val5.anchorMin; val30.anchorMax = val5.anchorMax; val30.pivot = val5.pivot; val30.sizeDelta = val5.sizeDelta; val30.anchoredPosition = new Vector2(val5.anchoredPosition.x, val5.anchoredPosition.y - val5.sizeDelta.y * 2f - 60f); } else { val30.anchorMin = new Vector2(0.5f, 0.5f); val30.anchorMax = new Vector2(0.5f, 0.5f); val30.pivot = new Vector2(0.5f, 0.5f); val30.sizeDelta = new Vector2(184f, 30f); val30.anchoredPosition = new Vector2(0f, -125f); } GameObject val32 = new GameObject("Label"); val32.transform.SetParent(val29.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; ((Graphic)val34).raycastTarget = false; font(val34, array2); GameObject val35 = new GameObject("Checkbox"); val35.transform.SetParent(val29.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>(); ((Graphic)val37).raycastTarget = true; if ((Object)(object)val8 != (Object)null) { Image componentInChildren3 = val8.GetComponentInChildren<Image>(); if ((Object)(object)componentInChildren3 != (Object)null) { val37.sprite = componentInChildren3.sprite; val37.type = (Type)1; val37.fillCenter = true; ((Graphic)val37).color = ((Graphic)componentInChildren3).color; val37.pixelsPerUnitMultiplier = componentInChildren3.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; ((Graphic)toggleButtonText).raycastTarget = false; font(toggleButtonText, array2); ((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() { Reselement reselement = Object.FindObjectOfType<Reselement>(true); if ((Object)(object)reselement == (Object)null) { return; } 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); } } } 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 { } internal class RPCLag { [HarmonyPatch(typeof(NetworkManager), "Awake")] [HarmonyPostfix] private static void RPCLagFix(NetworkManager __instance) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) __instance.LogLevel = (LogLevel)2; } } }