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 FixCameraResolution v1.5.3
Fix Camera Resolution.dll
Decompiled 2 weeks 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 System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using Microsoft.CodeAnalysis; using Rumi.FixCameraResolutions.Fogs; using Rumi.FixCameraResolutions.HUD; using Rumi.FixCameraResolutions.Resolutions; using Rumi.FixCameraResolutions.Visors; using RuniOS.LowLevel; using UnityEngine; using UnityEngine.LowLevel; using UnityEngine.PlayerLoop; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Fix Camera Resolution")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Fix Camera Resolution")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("dabb3c14-d069-4fdb-87ea-c7169dc3ef9e")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] 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; } } } namespace RuniOS.LowLevel { internal static class RuniPlayerLoop { private static UpdateFunction? allRegisteredDelegate; public static event UpdateFunction onInit { add { Register<Initialization>(value); } remove { Unregister<Initialization>(value); } } public static event UpdateFunction onEarlyUpdate { add { Register<EarlyUpdate>(value); } remove { Unregister<EarlyUpdate>(value); } } public static event UpdateFunction onFixedUpdate { add { Register<FixedUpdate>(value); } remove { Unregister<FixedUpdate>(value); } } public static event UpdateFunction onPreUpdate { add { Register<PreUpdate>(value); } remove { Unregister<PreUpdate>(value); } } public static event UpdateFunction onUpdate { add { Register<Update>(value); } remove { Unregister<Update>(value); } } public static event UpdateFunction onPreLateUpdate { add { Register<PreLateUpdate>(value); } remove { Unregister<PreLateUpdate>(value); } } public static event UpdateFunction onPostLateUpdate { add { Register<PostLateUpdate>(value); } remove { Unregister<PostLateUpdate>(value); } } private static void Clear() { UnregisterAll(allRegisteredDelegate); allRegisteredDelegate = null; } public static bool Register<T>(UpdateFunction? updateDelegate) { return Register(typeof(T), updateDelegate); } public static bool Register(Type? targetType, UpdateFunction? updateDelegate) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown if (targetType == null || updateDelegate == null) { return false; } PlayerLoopSystem loop = PlayerLoop.GetCurrentPlayerLoop(); bool result = InternalRegister(ref loop, targetType, updateDelegate); PlayerLoop.SetPlayerLoop(loop); allRegisteredDelegate = (UpdateFunction)Delegate.Combine((Delegate?)(object)allRegisteredDelegate, (Delegate?)(object)updateDelegate); return result; } private static bool InternalRegister(ref PlayerLoopSystem loop, Type? targetType, UpdateFunction? updateDelegate) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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) if (targetType == null || updateDelegate == null || loop.subSystemList == null) { return false; } for (int i = 0; i < loop.subSystemList.Length; i++) { PlayerLoopSystem loop2 = loop.subSystemList[i]; if (loop2.type == targetType) { ref UpdateFunction updateDelegate2 = ref loop2.updateDelegate; updateDelegate2 = (UpdateFunction)Delegate.Combine((Delegate?)(object)updateDelegate2, (Delegate?)(object)updateDelegate); loop.subSystemList[i] = loop2; return true; } if (InternalRegister(ref loop2, targetType, updateDelegate)) { loop.subSystemList[i] = loop2; return true; } } return false; } public static void Unregister<T>(UpdateFunction? updateDelegate) { Unregister(typeof(T), updateDelegate); } public static void Unregister(Type targetType, UpdateFunction? updateDelegate) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown if (updateDelegate == null || targetType == null) { return; } PlayerLoopSystem loop = PlayerLoop.GetCurrentPlayerLoop(); InternalUnregister(ref loop, targetType, updateDelegate); PlayerLoop.SetPlayerLoop(loop); if (allRegisteredDelegate != null) { Delegate[] invocationList = ((Delegate)(object)updateDelegate).GetInvocationList(); foreach (Delegate @delegate in invocationList) { allRegisteredDelegate = (UpdateFunction)Delegate.Remove((Delegate?)(object)allRegisteredDelegate, (Delegate?)(UpdateFunction)@delegate); } } } public static void UnregisterAll(UpdateFunction? updateDelegate) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown if (updateDelegate == null) { return; } PlayerLoopSystem loop = PlayerLoop.GetCurrentPlayerLoop(); InternalUnregister(ref loop, null, updateDelegate); PlayerLoop.SetPlayerLoop(loop); if (allRegisteredDelegate != null) { Delegate[] invocationList = ((Delegate)(object)updateDelegate).GetInvocationList(); foreach (Delegate @delegate in invocationList) { allRegisteredDelegate = (UpdateFunction)Delegate.Remove((Delegate?)(object)allRegisteredDelegate, (Delegate?)(UpdateFunction)@delegate); } } } private static void InternalUnregister(ref PlayerLoopSystem loop, Type? targetType, UpdateFunction? updateDelegate) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0059: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown if (updateDelegate == null || loop.subSystemList == null) { return; } for (int i = 0; i < loop.subSystemList.Length; i++) { PlayerLoopSystem loop2 = loop.subSystemList[i]; if (targetType == null || loop2.type == targetType) { Delegate[] invocationList = ((Delegate)(object)updateDelegate).GetInvocationList(); foreach (Delegate @delegate in invocationList) { ref UpdateFunction updateDelegate2 = ref loop2.updateDelegate; updateDelegate2 = (UpdateFunction)Delegate.Remove((Delegate?)(object)updateDelegate2, (Delegate?)(UpdateFunction)@delegate); } } InternalUnregister(ref loop2, targetType, updateDelegate); loop.subSystemList[i] = loop2; } } } } namespace Rumi.FixCameraResolutions { internal static class Debug { public static void Log(object data) { ManualLogSource? logger = FCRPlugin.logger; if (logger != null) { logger.LogInfo(data); } } public static void LogWarning(object data) { ManualLogSource? logger = FCRPlugin.logger; if (logger != null) { logger.LogWarning(data); } } public static void LogError(object data) { ManualLogSource? logger = FCRPlugin.logger; if (logger != null) { logger.LogError(data); } } } [BepInPlugin("Rumi.FixCameraResolutions", "FixCameraResolutions", "1.5.3")] public sealed class FCRPlugin : BaseUnityPlugin { public const string modGuid = "Rumi.FixCameraResolutions"; public const string modName = "FixCameraResolutions"; public const string modVersion = "1.5.3"; private static int repatchFrame = 0; internal static ManualLogSource? logger { get; private set; } = null; public static FCRResConfig? resConfig { get; private set; } public static FCRHUDConfig? hudConfig { get; private set; } public static FCRHDRPConfig? hdrpConfig { get; private set; } public static FCRVisorConfig? visorConfig { get; private set; } internal static Harmony harmony { get; } = new Harmony("Rumi.FixCameraResolutions"); private void Awake() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown logger = ((BaseUnityPlugin)this).Logger; Debug.Log("Start loading plugin..."); resConfig = FCRResConfig.Create(((BaseUnityPlugin)this).Config); hudConfig = FCRHUDConfig.Create(((BaseUnityPlugin)this).Config); hdrpConfig = FCRHDRPConfig.Create(((BaseUnityPlugin)this).Config); visorConfig = FCRVisorConfig.Create(((BaseUnityPlugin)this).Config); if (Type.GetType("LethalConfig.LethalConfigManager, LethalConfig, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", throwOnError: false) != null) { try { Debug.Log("Lethal Config Registration"); if (resConfig != null) { FCRResConfig.LethalConfig.Patch(resConfig); } if (hudConfig != null) { FCRHUDConfig.LethalConfig.Patch(hudConfig); } if (hdrpConfig != null) { FCRHDRPConfig.LethalConfig.Patch(hdrpConfig); } if (visorConfig != null) { FCRVisorConfig.LethalConfig.Patch(visorConfig); } } catch (Exception data) { Debug.LogError(data); Debug.LogWarning("Lethal Config Registration Fail!"); } } ((BaseUnityPlugin)this).Config.Save(); Patch(); RuniPlayerLoop.onUpdate += new UpdateFunction(OnRepatchUpdate); Debug.Log("Plugin FixCameraResolutions is loaded!"); } private static void OnRepatchUpdate() { if (repatchFrame > 0) { repatchFrame--; if (repatchFrame == 0) { RepatchImmediate(); } } } public static void Repatch() { repatchFrame = 1; } public static void RepatchImmediate() { FCRResPatches.UpdateAll(); FCRHUDPatches.UpdateHUDManager(HUDManager.Instance); FCRHDRPPatches.UpdateAll(); FCRVisorPatches.UpdateAllPlayer(); Unpatch(); Patch(); } private static void Patch() { FCRResPatches.Patch(); FCRHUDPatches.Patch(); FCRHDRPPatches.Patch(); FCRVisorPatches.Patch(); } private static void Unpatch() { Debug.Log("Unpatch..."); try { harmony.UnpatchSelf(); } catch (Exception data) { Debug.LogError(data); Debug.LogError("Unpatch Fail!"); } Debug.Log("Unpatched!"); } } public static class FCRUtility { public static Vector2 Multiply(this Vector2 position, float x, float y) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) return new Vector2(position.x * x, position.y * y); } } } namespace Rumi.FixCameraResolutions.Visors { public sealed class FCRVisorConfig { public static class LethalConfig { [MethodImpl(MethodImplOptions.NoInlining)] public static void Patch(FCRVisorConfig config) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config._disable, false)); } } private readonly ConfigEntry<bool> _disable; public const bool dDisable = false; public bool disable { get { return _disable.Value; } set { _disable.Value = value; } } internal static FCRVisorConfig? Create(ConfigFile config) { Debug.Log("Visor Config Loading..."); try { FCRVisorConfig result = new FCRVisorConfig(config); Debug.Log("Visor Config Loaded!"); return result; } catch (Exception data) { Debug.LogError(data); Debug.LogWarning("Failed to load config file\nSettings will be loaded with defaults!"); } return null; } private FCRVisorConfig(ConfigFile config) { _disable = config.Bind<bool>("Visors", "Disable", false, "Disables visor rendering"); _disable.SettingChanged += delegate { FCRPlugin.Repatch(); }; } } public static class FCRVisorPatches { private static readonly FieldInfo helmetGoopField = AccessTools.Field(typeof(HUDManager), "helmetGoop"); private static readonly Dictionary<int, bool> originalRendererStates = new Dictionary<int, bool>(); private static readonly Dictionary<int, GameObject> overlayObjects = new Dictionary<int, GameObject>(); private static Mesh? quadMesh; public static bool disable => FCRPlugin.visorConfig?.disable ?? false; [HarmonyPatch(typeof(PlayerControllerB), "Start")] [HarmonyPostfix] private static void PlayerControllerB_Start_Postfix(PlayerControllerB __instance) { UpdatePlayer(__instance); } [HarmonyPatch(typeof(HUDManager), "DisplaySpitOnHelmet")] [HarmonyPostfix] private static void HUDManager_DisplaySpitOnHelmet_Postfix() { SyncOverlayState(GameNetworkManager.Instance?.localPlayerController); } [HarmonyPatch(typeof(HUDManager), "Update")] [HarmonyPostfix] private static void HUDManager_Update_Postfix() { SyncOverlayState(GameNetworkManager.Instance?.localPlayerController); } public static void UpdateAllPlayer() { PlayerControllerB[] array = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { UpdatePlayer(array[i]); } } public static void UpdatePlayer(PlayerControllerB? player) { if (!((Object)(object)player?.localVisor == (Object)null)) { Transform val = player.localVisor.Find("ScavengerHelmet"); if (!((Object)(object)val == (Object)null)) { ((Component)val).gameObject.SetActive(true); UpdateHelmetRenderers(val); EnsureOverlayObject(player); SyncOverlayState(player); } } } private static void UpdateHelmetRenderers(Transform scavengerHelmet) { Renderer[] componentsInChildren = ((Component)scavengerHelmet).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { int instanceID = ((Object)val).GetInstanceID(); if (!originalRendererStates.ContainsKey(instanceID)) { originalRendererStates[instanceID] = val.enabled; } val.enabled = !disable && originalRendererStates[instanceID]; } } private static GameObject? GetHelmetGoop() { if ((Object)(object)HUDManager.Instance == (Object)null || helmetGoopField == null) { return null; } object? value = helmetGoopField.GetValue(HUDManager.Instance); return (GameObject?)((value is GameObject) ? value : null); } private static void EnsureOverlayObject(PlayerControllerB? player) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown if ((Object)(object)player?.gameplayCamera == (Object)null) { return; } int instanceID = ((Object)player).GetInstanceID(); if (overlayObjects.TryGetValue(instanceID, out GameObject value) && (Object)(object)value != (Object)null) { UpdateOverlayTransform(player, value.transform); return; } GameObject helmetGoop = GetHelmetGoop(); Renderer val = (((Object)(object)helmetGoop != (Object)null) ? helmetGoop.GetComponentInChildren<Renderer>(true) : null); if (!((Object)(object)val == (Object)null)) { value = new GameObject("FixCameraHelmetGoopOverlay"); value.layer = ((Component)player.gameplayCamera).gameObject.layer; value.transform.SetParent(((Component)player.gameplayCamera).transform, false); value.AddComponent<MeshFilter>().sharedMesh = GetQuadMesh(); MeshRenderer obj = value.AddComponent<MeshRenderer>(); ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; ((Renderer)obj).lightProbeUsage = (LightProbeUsage)0; ((Renderer)obj).reflectionProbeUsage = (ReflectionProbeUsage)0; ((Renderer)obj).motionVectorGenerationMode = (MotionVectorGenerationMode)2; ((Renderer)obj).allowOcclusionWhenDynamic = false; ((Renderer)obj).sharedMaterials = val.sharedMaterials; ((Renderer)obj).enabled = false; UpdateOverlayTransform(player, value.transform); value.SetActive(false); overlayObjects[instanceID] = value; } } private static void SyncOverlayState(PlayerControllerB? player) { if ((Object)(object)player?.gameplayCamera == (Object)null) { return; } EnsureOverlayObject(player); int instanceID = ((Object)player).GetInstanceID(); if (overlayObjects.TryGetValue(instanceID, out GameObject value) && !((Object)(object)value == (Object)null)) { GameObject helmetGoop = GetHelmetGoop(); Renderer val = (((Object)(object)helmetGoop != (Object)null) ? helmetGoop.GetComponentInChildren<Renderer>(true) : null); Renderer component = value.GetComponent<Renderer>(); if (!((Object)(object)val == (Object)null) && !((Object)(object)component == (Object)null)) { UpdateOverlayTransform(player, value.transform); component.sharedMaterials = val.sharedMaterials; bool flag = disable && (Object)(object)helmetGoop != (Object)null && helmetGoop.activeInHierarchy; value.SetActive(flag); component.enabled = flag; } } } private static void UpdateOverlayTransform(PlayerControllerB player, Transform overlayTransform) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) Camera gameplayCamera = player.gameplayCamera; float num = Mathf.Max(gameplayCamera.nearClipPlane + 0.015f, 0.05f); float num2 = 2f * Mathf.Tan(gameplayCamera.fieldOfView * 0.5f * ((float)Math.PI / 180f)) * num; float num3 = num2 * gameplayCamera.aspect; overlayTransform.localPosition = new Vector3(0f, 0f, num); overlayTransform.localRotation = Quaternion.identity; overlayTransform.localScale = new Vector3(num3 * 1.02f, num2 * 1.02f, 1f); } private static Mesh? GetQuadMesh() { if ((Object)(object)quadMesh != (Object)null) { return quadMesh; } GameObject val = GameObject.CreatePrimitive((PrimitiveType)5); try { MeshFilter component = val.GetComponent<MeshFilter>(); quadMesh = (((Object)(object)component != (Object)null) ? component.sharedMesh : null); } finally { Object.DestroyImmediate((Object)(object)val); } return quadMesh; } internal static void Patch() { if (!disable) { return; } Debug.Log("Visor Patch..."); try { FCRPlugin.harmony.PatchAll(typeof(FCRVisorPatches)); Debug.Log("Visor Patched!"); } catch (Exception data) { Debug.LogError(data); Debug.LogError("Resolution Patch Fail!"); } } } } namespace Rumi.FixCameraResolutions.Resolutions { public sealed class FCRResConfig { public static class LethalConfig { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static GenericButtonHandler <>9__0_0; internal void <Patch>b__0_0() { FCRResPatches.UpdateAll(); } } [MethodImpl(MethodImplOptions.NoInlining)] public static void Patch(FCRResConfig config) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_003a: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0068: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00a9: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_00ea: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config._enable, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config._autoSize, new BoolCheckBoxOptions { RequiresRestart = false, CanModifyCallback = new CanModifyDelegate(CanModifyAutoSize) })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config._checkResolutionEveryFrame, new BoolCheckBoxOptions { RequiresRestart = false, CanModifyCallback = new CanModifyDelegate(CanModifyFrame) })); ConfigEntry<int> width = config._width; IntSliderOptions val = new IntSliderOptions(); ((BaseRangeOptions<int>)val).Min = 10; ((BaseRangeOptions<int>)val).Max = 3840; ((BaseOptions)val).RequiresRestart = false; ((BaseOptions)val).CanModifyCallback = new CanModifyDelegate(CanModifySize); LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(width, val)); ConfigEntry<int> height = config._height; IntSliderOptions val2 = new IntSliderOptions(); ((BaseRangeOptions<int>)val2).Min = 10; ((BaseRangeOptions<int>)val2).Max = 2160; ((BaseOptions)val2).RequiresRestart = false; ((BaseOptions)val2).CanModifyCallback = new CanModifyDelegate(CanModifySize); LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(height, val2)); object obj = <>c.<>9__0_0; if (obj == null) { GenericButtonHandler val3 = delegate { FCRResPatches.UpdateAll(); }; <>c.<>9__0_0 = val3; obj = (object)val3; } LethalConfigManager.AddConfigItem((BaseConfigItem)new GenericButtonConfigItem("Resolutions", "Refresh resolution", "If the resolution has been released for some reason, you can refresh it using this button.", "Refresh", (GenericButtonHandler)obj)); } private static CanModifyResult CanModifyAutoSize() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) return CanModifyResult.op_Implicit((FCRPlugin.resConfig?.enable ?? true, "Resolution patch is disabled and cannot be modified")); } private static CanModifyResult CanModifySize() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) CanModifyResult val = CanModifyAutoSize(); if (CanModifyResult.op_Implicit(val)) { return CanModifyResult.op_Implicit((!(FCRPlugin.resConfig?.autoSize ?? true), "Since auto size is enabled, the size is automatically set to the current game window size.")); } return val; } private static CanModifyResult CanModifyFrame() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) CanModifyResult val = CanModifyAutoSize(); if (CanModifyResult.op_Implicit(val)) { return CanModifyResult.op_Implicit((FCRPlugin.resConfig?.autoSize ?? true, "Auto size is disabled and cannot be modified")); } return val; } } private readonly ConfigEntry<bool> _enable; public const bool dEnable = true; private readonly ConfigEntry<bool> _autoSize; public const bool dAutoSize = true; private readonly ConfigEntry<int> _width; public const int dWidth = 1920; private readonly ConfigEntry<int> _height; public const int dHeight = 1080; private readonly ConfigEntry<bool> _checkResolutionEveryFrame; public const bool dCheckResolutionEveryFrame = false; public bool enable { get { return _enable.Value; } set { _enable.Value = value; } } public bool autoSize { get { return _autoSize.Value; } set { _autoSize.Value = value; } } public int width { get { return _width.Value; } set { _width.Value = value; } } public int height { get { return _height.Value; } set { _height.Value = value; } } public bool checkResolutionEveryFrame { get { return _checkResolutionEveryFrame.Value; } set { _checkResolutionEveryFrame.Value = value; } } internal static FCRResConfig? Create(ConfigFile config) { Debug.Log("Resolution Config Loading..."); try { FCRResConfig result = new FCRResConfig(config); Debug.Log("Resolution Config Loaded!"); return result; } catch (Exception data) { Debug.LogError(data); Debug.LogWarning("Failed to load config file\nSettings will be loaded with defaults!"); } return null; } private FCRResConfig(ConfigFile config) { //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Expected O, but got Unknown _enable = config.Bind<bool>("Resolutions", "Enable", true, "When enabled, the camera resolution will be modified."); _enable.SettingChanged += delegate { FCRPlugin.Repatch(); }; _autoSize = config.Bind<bool>("Resolutions", "Auto Size", true, "When enabled, sets the camera size to the size of the current game window."); _autoSize.SettingChanged += delegate { FCRResPatches.UpdateAll(); }; _checkResolutionEveryFrame = config.Bind<bool>("Resolutions", "Check Resolution Every Frame", false, "Checks if the resolution has changed every frame and updates accordingly. May affect performance."); _checkResolutionEveryFrame.SettingChanged += delegate { FCRPlugin.Repatch(); }; _width = config.Bind<int>("Resolutions", "Width", 1920, new ConfigDescription(string.Empty, (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 3840), Array.Empty<object>())); _width.SettingChanged += delegate { FCRResPatches.UpdateAll(); }; _height = config.Bind<int>("Resolutions", "Height", 1080, new ConfigDescription(string.Empty, (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 2160), Array.Empty<object>())); _height.SettingChanged += delegate { FCRResPatches.UpdateAll(); }; } } public static class FCRResPatches { private static class ResPatch { [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPostfix] private static void Terminal_Start_Postfix(Terminal __instance) { UpdateRenderTexture(__instance.playerScreenTex); UpdateRenderTexture(__instance.playerScreenTexHighRes); } [HarmonyPatch(typeof(IngamePlayerSettings), "SetPixelResolution")] [HarmonyPostfix] private static void IngamePlayerSettings_SetPixelResolution_Postfix(IngamePlayerSettings __instance) { UpdateRenderTexture(__instance.playerGameplayScreenTex); } } [HarmonyPatch(typeof(HUDManager))] private static class UpdatePath { private static int lastScreenWidth; private static int lastScreenHeight; [HarmonyPatch("Update")] [HarmonyPostfix] private static void Update() { if (lastScreenWidth != Screen.width || lastScreenHeight != Screen.height) { UpdateAll(); lastScreenWidth = Screen.width; lastScreenHeight = Screen.height; } } } public const int orgWidth = 860; public const int orgHeight = 520; public static bool enable => FCRPlugin.resConfig?.enable ?? true; public static bool autoSize => FCRPlugin.resConfig?.autoSize ?? true; public static bool checkResolutionEveryFrame => FCRPlugin.hudConfig?.checkResolutionEveryFrame ?? false; public static int width { get { if (enable) { if (autoSize) { return Screen.width; } return FCRPlugin.resConfig?.width ?? 1920; } return 860; } } public static int height { get { if (enable) { if (autoSize) { return Screen.height; } return FCRPlugin.resConfig?.height ?? 1080; } return 520; } } public static void UpdateAll() { UpdateAllTerminal(); UpdateAllPlayerCamera(); } public static void UpdateAllTerminal() { Terminal[] array = Object.FindObjectsByType<Terminal>((FindObjectsSortMode)0); foreach (Terminal obj in array) { UpdateRenderTexture(obj.playerScreenTex); UpdateRenderTexture(obj.playerScreenTexHighRes); } } public static void UpdateRenderTexture(RenderTexture renderTexture) { renderTexture.Release(); ((Texture)renderTexture).width = width; ((Texture)renderTexture).height = height; } public static void UpdateAllPlayerCamera() { PlayerControllerB[] array = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { UpdateCamera(array[i].gameplayCamera); } } public static void UpdateCamera(Camera camera) { camera.ResetAspect(); } internal static void Patch() { if (!enable) { return; } Debug.Log("Resolution Patch..."); try { FCRPlugin.harmony.PatchAll(typeof(ResPatch)); if (checkResolutionEveryFrame) { FCRPlugin.harmony.PatchAll(typeof(UpdatePath)); } Debug.Log("Resolution Patched!"); } catch (Exception data) { Debug.LogError(data); Debug.LogError("Resolution Patch Fail!"); } } } } namespace Rumi.FixCameraResolutions.HUD { public class FCRHUDConfig { public static class LethalConfig { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static GenericButtonHandler <>9__0_0; internal void <Patch>b__0_0() { FCRHUDPatches.UpdateHUDManager(HUDManager.Instance); } } [MethodImpl(MethodImplOptions.NoInlining)] public static void Patch(FCRHUDConfig config) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_003a: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0067: 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_0072: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config._fixedAspectRatio, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config._checkResolutionEveryFrame, new BoolCheckBoxOptions { RequiresRestart = false, CanModifyCallback = new CanModifyDelegate(CanModifyFrame) })); object obj = <>c.<>9__0_0; if (obj == null) { GenericButtonHandler val = delegate { FCRHUDPatches.UpdateHUDManager(HUDManager.Instance); }; <>c.<>9__0_0 = val; obj = (object)val; } LethalConfigManager.AddConfigItem((BaseConfigItem)new GenericButtonConfigItem("HUD", "Refresh resolution", "If the resolution has been released for some reason, you can refresh it using this button.", "Refresh", (GenericButtonHandler)obj)); } private static CanModifyResult CanModifyFrame() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) return CanModifyResult.op_Implicit((!(FCRPlugin.hudConfig?.fixedAspectRatio ?? true), "Fixed Aspect Ratio is enabled and cannot be modified")); } } private readonly ConfigEntry<bool> _fixedAspectRatio; public const bool dFixedAspectRatio = true; private readonly ConfigEntry<bool> _checkResolutionEveryFrame; public const bool dCheckResolutionEveryFrame = false; public bool fixedAspectRatio { get { return _fixedAspectRatio.Value; } set { _fixedAspectRatio.Value = value; } } public bool checkResolutionEveryFrame { get { return _checkResolutionEveryFrame.Value; } set { _checkResolutionEveryFrame.Value = value; } } internal static FCRHUDConfig? Create(ConfigFile config) { Debug.Log("HUD Config Loading..."); try { FCRHUDConfig result = new FCRHUDConfig(config); Debug.Log("HUD Config Loaded!"); return result; } catch (Exception data) { Debug.LogError(data); Debug.LogWarning("Failed to load config file\nSettings will be loaded with defaults!"); } return null; } private FCRHUDConfig(ConfigFile config) { _fixedAspectRatio = config.Bind<bool>("HUD", "Fixed Aspect Ratio", true, "Turn off to adjust the UI scaling dynamically instead of keeping the default fixed ratio."); _fixedAspectRatio.SettingChanged += delegate { FCRPlugin.Repatch(); }; _checkResolutionEveryFrame = config.Bind<bool>("HUD", "Check Resolution Every Frame", false, "Checks if the resolution has changed every frame and updates accordingly. May affect performance."); _checkResolutionEveryFrame.SettingChanged += delegate { FCRPlugin.Repatch(); }; } } public static class FCRHUDPatches { [HarmonyPatch(typeof(HUDManager))] private static class StartPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start(HUDManager __instance) { UpdateHUDManager(__instance); } } [HarmonyPatch(typeof(HUDManager))] private static class UpdatePath { private static int lastScreenWidth; private static int lastScreenHeight; [HarmonyPatch("Update")] [HarmonyPostfix] private static void Update(HUDManager __instance) { if (lastScreenWidth != Screen.width || lastScreenHeight != Screen.height) { UpdateHUDManager(__instance); lastScreenWidth = Screen.width; lastScreenHeight = Screen.height; } } } public static bool fixedAspectRatio => FCRPlugin.hudConfig?.fixedAspectRatio ?? true; public static bool checkResolutionEveryFrame => FCRPlugin.hudConfig?.checkResolutionEveryFrame ?? false; public static void UpdateHUDManager(HUDManager? instance) { if ((Object)(object)instance == (Object)null) { return; } AspectRatioFitter component = instance.HUDContainer.GetComponent<AspectRatioFitter>(); if ((Object)(object)component != (Object)null) { UpdateFitter(component); } Transform parent = instance.HUDContainer.transform.parent; Transform val = (((Object)(object)parent != (Object)null) ? parent.Find("Panel") : null); if ((Object)(object)val != (Object)null) { AspectRatioFitter component2 = ((Component)val).GetComponent<AspectRatioFitter>(); if ((Object)(object)component2 != (Object)null) { UpdateFitter(component2); } } } public static void UpdateFitter(AspectRatioFitter aspectRatioFitter) { if (fixedAspectRatio) { aspectRatioFitter.aspectRatio = 1.76f; } else { aspectRatioFitter.aspectRatio = (float)Screen.width / (float)Screen.height; } } internal static void Patch() { if (fixedAspectRatio) { return; } Debug.Log("HUD Patch..."); try { FCRPlugin.harmony.PatchAll(typeof(StartPatch)); if (checkResolutionEveryFrame) { FCRPlugin.harmony.PatchAll(typeof(UpdatePath)); } Debug.Log("HUD Patched!"); } catch (Exception data) { Debug.LogError(data); Debug.LogError("Resolution Patch Fail!"); } } } } namespace Rumi.FixCameraResolutions.Fogs { public enum AntialiasingMode { None, FXAA, TAA, SMAA } public sealed class FCRHDRPConfig { public static class LethalConfig { [MethodImpl(MethodImplOptions.NoInlining)] public static void Patch(FCRHDRPConfig config) { LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<AntialiasingMode>(config._antialiasingMode, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<HDRPMode>(config._bloomMode, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<FogMode>(config._fogMode, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<HDRPMode>(config._shadowMode, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<HDRPMode>(config._postProcessingMode, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<HDRPMode>(config._vignetteMode, false)); } } private readonly ConfigEntry<AntialiasingMode> _antialiasingMode; public const AntialiasingMode dAntialiasingMode = AntialiasingMode.None; private readonly ConfigEntry<HDRPMode> _bloomMode; public const HDRPMode dBloomMode = HDRPMode.Vanilla; private readonly ConfigEntry<FogMode> _fogMode; public const FogMode dFogMode = FogMode.Vanilla; private readonly ConfigEntry<HDRPMode> _shadowMode; public const HDRPMode dShadowMode = HDRPMode.Vanilla; private readonly ConfigEntry<HDRPMode> _postProcessingMode; public const HDRPMode dPostProcessingMode = HDRPMode.Vanilla; private readonly ConfigEntry<HDRPMode> _vignetteMode; public const HDRPMode dVignetteMode = HDRPMode.Vanilla; public AntialiasingMode antialiasingMode { get { return _antialiasingMode.Value; } set { _antialiasingMode.Value = value; } } public HDRPMode bloomMode { get { return _bloomMode.Value; } set { _bloomMode.Value = value; } } public FogMode fogMode { get { return _fogMode.Value; } set { _fogMode.Value = value; } } public HDRPMode shadowMode { get { return _shadowMode.Value; } set { _shadowMode.Value = value; } } public HDRPMode postProcessingMode { get { return _postProcessingMode.Value; } set { _postProcessingMode.Value = value; } } public HDRPMode vignetteMode { get { return _vignetteMode.Value; } set { _vignetteMode.Value = value; } } internal static FCRHDRPConfig? Create(ConfigFile config) { Debug.Log("HDRP Config Loading..."); try { FCRHDRPConfig result = new FCRHDRPConfig(config); Debug.Log("HDRP Config Loaded!"); return result; } catch (Exception data) { Debug.LogError(data); Debug.LogWarning("Failed to load config file\nSettings will be loaded with defaults!"); } return null; } private FCRHDRPConfig(ConfigFile config) { _antialiasingMode = config.Bind<AntialiasingMode>("HDRP", "Antialiasing", AntialiasingMode.None, (ConfigDescription)null); _bloomMode = config.Bind<HDRPMode>("HDRP", "Bloom", HDRPMode.Vanilla, (ConfigDescription)null); _fogMode = config.Bind<FogMode>("HDRP", "Fog Rendering Method", FogMode.Vanilla, "Sets how fog is rendered.\r\n\r\n-------------------------\r\n\r\n\r\nVanilla\r\n-------------------------\r\nUse default fog settings\r\n\r\n\r\nHide\r\n-------------------------\r\nIt doesn't completely remove the fog, but it adjusts it so that it doesn't obstruct your vision.\r\n\r\n\r\nDisable\r\n-------------------------\r\nCompletely disables all fog rendering.\r\n\r\n\r\nForceDisable\r\n-------------------------\r\nAttempts to completely disable all fog rendering on every frame.\r\n\r\nCan be used when fog removal is not working on a mod planet\r\n\r\nDo not use this setting unless you have a problem\r\n\r\n\r\n-------------------------\r\n\r\n"); _shadowMode = config.Bind<HDRPMode>("HDRP", "Shadow", HDRPMode.Vanilla, (ConfigDescription)null); _postProcessingMode = config.Bind<HDRPMode>("HDRP", "Post Processing", HDRPMode.Vanilla, (ConfigDescription)null); _vignetteMode = config.Bind<HDRPMode>("HDRP", "Vignette", HDRPMode.Vanilla, (ConfigDescription)null); _antialiasingMode.SettingChanged += delegate { FCRPlugin.Repatch(); }; _bloomMode.SettingChanged += delegate { FCRPlugin.Repatch(); }; _fogMode.SettingChanged += delegate { FCRPlugin.Repatch(); }; _shadowMode.SettingChanged += delegate { FCRPlugin.Repatch(); }; _postProcessingMode.SettingChanged += delegate { FCRPlugin.Repatch(); }; _vignetteMode.SettingChanged += delegate { FCRPlugin.Repatch(); }; } } public static class FCRHDRPPatches { [HarmonyPatch(typeof(Volume))] private static class OnEnablePatch { [HarmonyPatch("OnEnable")] [HarmonyPostfix] private static void OnEnable(Volume __instance) { UpdateVolume(__instance); } } [HarmonyPatch(typeof(Volume))] private static class UpdatePatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void Update(Volume __instance) { UpdateVolume(__instance); } } [HarmonyPatch(typeof(HDAdditionalCameraData))] private static class HDAdditionalCameraDataPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void Awake(HDAdditionalCameraData __instance) { UpdateHDCameraData(__instance); } } public static AntialiasingMode antialiasingMode => FCRPlugin.hdrpConfig?.antialiasingMode ?? AntialiasingMode.None; public static HDRPMode bloomMode => FCRPlugin.hdrpConfig?.bloomMode ?? HDRPMode.Vanilla; public static FogMode fogMode => FCRPlugin.hdrpConfig?.fogMode ?? FogMode.Vanilla; public static HDRPMode shadowMode => FCRPlugin.hdrpConfig?.shadowMode ?? HDRPMode.Vanilla; public static HDRPMode postProcessingMode => FCRPlugin.hdrpConfig?.postProcessingMode ?? HDRPMode.Vanilla; public static HDRPMode vignetteMode => FCRPlugin.hdrpConfig?.vignetteMode ?? HDRPMode.Vanilla; public static void UpdateAll() { UpdateAllVolume(); UpdateAllHDCameraData(); } public static void UpdateAllVolume() { Volume[] array = Object.FindObjectsByType<Volume>((FindObjectsInactive)1, (FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { UpdateVolume(array[i]); } } public static void UpdateVolume(Volume volume) { Fog val = default(Fog); if (!((Object)(object)volume.sharedProfile == (Object)null) && volume.sharedProfile.TryGet<Fog>(ref val)) { ((VolumeComponent)val).active = fogMode != FogMode.Disable && fogMode != FogMode.ForceDisable; } } public static void UpdateAllHDCameraData() { HDAdditionalCameraData[] array = Object.FindObjectsByType<HDAdditionalCameraData>((FindObjectsInactive)1, (FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { UpdateHDCameraData(array[i]); } } public static void UpdateHDCameraData(HDAdditionalCameraData cameraData) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (((Object)((Component)cameraData).gameObject).name == "SpectateCamera") { cameraData.customRenderingSettings = !IsVanillaMode(); } if (((Object)((Component)cameraData).gameObject).name != "UICamera") { cameraData.antialiasing = (AntialiasingMode)antialiasingMode; ((BitArray128)(ref cameraData.renderingPathCustomFrameSettingsOverrideMask.mask))[91u] = antialiasingMode != AntialiasingMode.None; ((FrameSettings)(ref cameraData.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)91, antialiasingMode != AntialiasingMode.None); } ((BitArray128)(ref cameraData.renderingPathCustomFrameSettingsOverrideMask.mask))[84u] = bloomMode != HDRPMode.Vanilla; ((FrameSettings)(ref cameraData.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)84, bloomMode == HDRPMode.Vanilla); ((BitArray128)(ref cameraData.renderingPathCustomFrameSettingsOverrideMask.mask))[28u] = fogMode != FogMode.Vanilla; ((FrameSettings)(ref cameraData.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)28, fogMode == FogMode.Vanilla); ((BitArray128)(ref cameraData.renderingPathCustomFrameSettingsOverrideMask.mask))[20u] = shadowMode != HDRPMode.Vanilla; ((FrameSettings)(ref cameraData.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)20, shadowMode == HDRPMode.Vanilla); ((BitArray128)(ref cameraData.renderingPathCustomFrameSettingsOverrideMask.mask))[6u] = postProcessingMode != HDRPMode.Vanilla; ((FrameSettings)(ref cameraData.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)6, postProcessingMode == HDRPMode.Vanilla); ((BitArray128)(ref cameraData.renderingPathCustomFrameSettingsOverrideMask.mask))[87u] = vignetteMode != HDRPMode.Vanilla; ((FrameSettings)(ref cameraData.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)87, vignetteMode == HDRPMode.Vanilla); } private static bool IsVanillaMode() { if (antialiasingMode == AntialiasingMode.None && bloomMode == HDRPMode.Vanilla && fogMode == FogMode.Vanilla && shadowMode == HDRPMode.Vanilla && postProcessingMode == HDRPMode.Vanilla) { return vignetteMode == HDRPMode.Vanilla; } return false; } internal static void Patch() { if (IsVanillaMode()) { return; } Debug.Log("Fog Patch..."); try { FCRPlugin.harmony.PatchAll(typeof(HDAdditionalCameraDataPatch)); if (fogMode == FogMode.Disable || fogMode == FogMode.ForceDisable) { FCRPlugin.harmony.PatchAll(typeof(OnEnablePatch)); if (fogMode == FogMode.ForceDisable) { FCRPlugin.harmony.PatchAll(typeof(UpdatePatch)); } } Debug.Log("Fog Patched!"); } catch (Exception data) { Debug.LogError(data); Debug.LogError("Fog Patch Fail!"); } } } public enum FogMode { Vanilla, Hide, Disable, ForceDisable } public enum HDRPMode { Vanilla, Disable } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }