Decompiled source of HDLCPatch v1.4.0

HDLethalCompanyPatch.dll

Decompiled a month ago
using System;
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 HDLethalCompanyPatch.config;
using HDLethalCompanyPatch.patches;
using HarmonyLib;
using HarmonyLib.Public.Patching;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("HDLethalCompanyPatch")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+554f3d234305bf57003f79bd48ad0e82885a8635")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("HDLethalCompanyPatch")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace HDLethalCompanyPatch
{
	public enum FogSettingMethod
	{
		Sliders,
		Presets
	}
	public enum FogQualitySetting
	{
		Minimal,
		VeryLow,
		Low,
		Medium,
		High,
		VeryHigh,
		Extreme
	}
	public enum QualitySetting
	{
		VeryLow,
		Low,
		Medium,
		High
	}
	public enum AntiAliasingSetting
	{
		FAA,
		TAA,
		SMAA
	}
	public enum ResolutionSettingMethod
	{
		ScaleSlider,
		Presets,
		Custom
	}
	public enum ResolutionPreset
	{
		R640x480,
		R1280x720,
		R1920x1080,
		R2560x1440,
		R3840x2160
	}
	public static class HDLCPatchProperties
	{
		public const string Name = "HDLCPatch";

		public const string GUID = "HDLCPatch";

		public const string Version = "1.4.0";

		public static Assembly HDAssembly;

		public static object GraphicsPatchObj;

		public static Type GraphicsPatch;

		public static MethodInfo RemoveLodFromGameObject;

		public static MethodInfo SetShadowQuality;
	}
	[BepInPlugin("HDLCPatch", "HDLCPatch", "1.4.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class HDLCPatch : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private static Harmony _harmony;

		public static ConfigEntry<QualitySetting> ShadowQuality;

		public static ConfigEntry<QualitySetting> LODQuality;

		public static ConfigEntry<QualitySetting> TextureQuality;

		public static ConfigEntry<FogQualitySetting> FogQuality;

		public static ConfigEntry<AntiAliasingSetting> AASetting;

		public static ConfigEntry<ResolutionSettingMethod> ResolutionMethod;

		public static ConfigEntry<ResolutionPreset> ResolutionPresetValue;

		public static ConfigEntry<FogSettingMethod> FogQualityMethod;

		public static ConfigEntry<float> VolumetricFogBudget;

		public static ConfigEntry<float> FogResolutionDepthRatio;

		public static ConfigEntry<float> ResolutionScale;

		public static ConfigEntry<int> ResolutionWidth;

		public static ConfigEntry<int> ResolutionHeight;

		public static ConfigEntry<bool> EnableFog;

		public static ConfigEntry<bool> EnablePostProcessing;

		public static ConfigEntry<bool> EnableFoliage;

		public static ConfigEntry<bool> EnableResolutionOverride;

		public static ConfigEntry<bool> EnableAntiAliasing;

		public static ConfigEntry<bool> DisableFoliageConfig;

		public static ConfigEntry<bool> DisableShadowConfig;

		public static ConfigEntry<bool> DisableCatwalkRemoval;

		public static ConfigEntry<bool> EnableSteamProfileImageFix;

		public static ConfigEntry<bool> DisableResolutionConfig;

		public static ConfigEntry<bool> DisableLODConfig;

		public static ConfigEntry<bool> DisablePostProcessConfig;

		public static ConfigEntry<bool> DisableTerminalResolutionFix;

		public static ConfigEntry<bool> DisableFogConfig;

		public static ConfigEntry<bool> DisableTextureConfig;

		public static Assembly HDLethal;

		public static bool HDLethalCompanyFound;

		private void Awake()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin HDLCPatch 1.4.0 is loaded!");
			_harmony = new Harmony("HDLCPatch");
			PatchHDLC();
			SetupConfig();
		}

		public static void PatchHDLC()
		{
			Logger.LogInfo((object)"Patching...");
			List<MethodBase> obj = (List<MethodBase>)Harmony.GetAllPatchedMethods();
			bool flag = false;
			bool flag2 = false;
			bool flag3 = true;
			foreach (MethodBase item in obj)
			{
				PatchInfo patchInfo = PatchManager.GetPatchInfo(item);
				Patch[] prefixes = patchInfo.prefixes;
				Patch[] postfixes = patchInfo.postfixes;
				Patch[] array = prefixes;
				foreach (Patch val in array)
				{
					if (val.PatchMethod.Name == "RoundPostFix" && (val.owner == "HDLethalCompany" || val.owner == "HDLethalCompanyRemake"))
					{
						Logger.LogInfo((object)"Attempting to unpatch HDLethalCompany RoundPostFix");
						_harmony.Unpatch(item, val.PatchMethod);
						HDLethal = val.PatchMethod.Module.Assembly;
						flag = true;
					}
					if (val.PatchMethod.Name == "StartPrefix" && (val.owner == "HDLethalCompany" || val.owner == "HDLethalCompanyRemake"))
					{
						Logger.LogInfo((object)"Attempting to unpatch HDLethalCompany RoundPostFix");
						_harmony.Unpatch(item, val.PatchMethod);
						flag2 = true;
					}
				}
				array = postfixes;
				foreach (Patch val2 in array)
				{
					if (val2.PatchMethod.Name == "UpdateScanNodesPostfix" && (val2.owner == "HDLethalCompany" || val2.owner == "HDLethalCompanyRemake"))
					{
						Logger.LogInfo((object)"Attempting to unpatch HDLethalCompany UpdateScanNodesPostfix");
						_harmony.Unpatch(item, val2.PatchMethod);
					}
				}
			}
			if (flag)
			{
				Logger.LogInfo((object)"Unpatch RoundPostfix success!");
			}
			else
			{
				Logger.LogWarning((object)"Failed to Unpatch RoundPostfix. Either HDLethalCompany is not installed or it failed.\nYou can ignore this if you do not want HDLethalCompany installed.");
			}
			if (flag2)
			{
				Logger.LogInfo((object)"Unpatch StartPrefix success!");
			}
			else
			{
				Logger.LogWarning((object)"Failed to Unpatch StartPrefix. Either HDLethalCompany is not installed or it failed.\nYou can ignore this if you do not want HDLethalCompany installed.");
			}
			if (flag2 && flag)
			{
				HDLethalCompanyFound = true;
			}
			_harmony.PatchAll(typeof(HDLCGraphicsPatch));
			try
			{
				if (HDLethalCompanyFound)
				{
					SetupInternalMethods(HDLethal);
				}
			}
			catch (Exception ex)
			{
				Logger.LogWarning((object)("Failed to set internal method references \n" + ex.ToString()));
				Logger.LogInfo((object)"Attempting to get assembly with a different method...");
				try
				{
					HDLethal = HarmonyGetAssembly("HDLethalCompany");
					SetupInternalMethods(HDLethal);
				}
				catch (Exception ex2)
				{
					Logger.LogError((object)("Backup method for getting assembly failed! \n" + ex2.ToString()));
					Logger.LogInfo((object)"Attempting 3rd method to get internal references...");
					try
					{
						HDLethal = GetAssembly("HDLethalCompany");
						SetupInternalMethods(HDLethal);
						goto end_IL_02a3;
					}
					catch (Exception ex3)
					{
						Logger.LogFatal((object)"All methods to get HDLethalCompany internal methods failed!");
						Logger.LogError((object)ex3.ToString());
						flag3 = false;
						goto end_IL_02a3;
					}
					end_IL_02a3:;
				}
			}
			if (flag3)
			{
				Logger.LogInfo((object)"Finished patching process");
			}
			else
			{
				Logger.LogWarning((object)"Failed to set internal references to HDLethalCompany methods. Either HDLethalCompany is not installed or it failed.\nYou can ignore this if you do not want HDLethalCompany installed.");
			}
		}

		public static Assembly GetAssembly(string assemblyName)
		{
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly in assemblies)
			{
				if (assembly.GetName().Name.Contains(assemblyName) && !assembly.GetName().Name.Contains("HDLethalCompanyPatch"))
				{
					Logger.LogInfo((object)("Got assembly: " + assembly.GetName().Name));
					return assembly;
				}
			}
			Logger.LogError((object)"Failed to get assembly");
			Logger.LogInfo((object)"Currently available assemblies from AppDomain.CurrentDomain: ");
			assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly2 in assemblies)
			{
				Logger.LogInfo((object)(assembly2.GetName().Name ?? ""));
			}
			return null;
		}

		public static Assembly HarmonyGetAssembly(string assemblyName)
		{
			foreach (Assembly item in AccessTools.AllAssemblies())
			{
				if (item.GetName().Name.Contains(assemblyName) && !item.GetName().Name.Contains("HDLethalCompanyPatch"))
				{
					Logger.LogInfo((object)("Got assembly: " + item.GetName().Name));
					return item;
				}
			}
			Logger.LogError((object)"Failed to get assembly");
			Logger.LogInfo((object)"Currently available assemblies from AccessTools: ");
			foreach (Assembly item2 in AccessTools.AllAssemblies())
			{
				Logger.LogInfo((object)(item2.GetName().Name ?? ""));
			}
			return null;
		}

		public static void SetupInternalMethods(Assembly assembly)
		{
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			Logger.LogInfo((object)"Creating references to internal methods...");
			try
			{
				HDLCPatchProperties.HDAssembly = assembly;
				Logger.LogInfo((object)("Got assembly of " + assembly.GetName().Name));
			}
			catch (Exception ex)
			{
				Logger.LogError((object)("Failed to get assembly reference\n" + ex.ToString()));
			}
			try
			{
				HDLCPatchProperties.GraphicsPatchObj = assembly.CreateInstance("HDLethalCompany.Patch.GraphicsPatch");
			}
			catch (Exception ex2)
			{
				Logger.LogError((object)("Failed to get reference to GraphicsPatch\n" + ex2.ToString()));
			}
			Type type = (HDLCPatchProperties.GraphicsPatch = HDLCPatchProperties.GraphicsPatchObj.GetType());
			HDLCPatchProperties.RemoveLodFromGameObject = type.GetMethod("RemoveLodFromGameObject");
			HDLCPatchProperties.SetShadowQuality = type.GetMethod("SetShadowQuality");
			HDLCGraphicsPatch.HDAssetBundle = (AssetBundle)HDLCPatchProperties.GraphicsPatch.GetField("assetBundle").GetValue(HDLCPatchProperties.GraphicsPatchObj);
			Logger.LogInfo((object)"References created!");
		}

		private void SetupConfig()
		{
			Logger.LogInfo((object)"Setting up config...");
			DisableLODConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatability", "DisableLODConfig", false, "Disables LOD settings.\nCheck this if you have issues with LOD's or another mod that manages them.");
			DisableResolutionConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatability", "DisableResolutionConfig", false, "Check this if you have another mod managing resolution or HUD elements break.");
			DisableCatwalkRemoval = ((BaseUnityPlugin)this).Config.Bind<bool>("LOD", "DisableCatwalkLODRemoval", false, "By default HDLethalCompany would remove the LOD for a Catwalk object.\nThis is here in case you have a reason to disable the removal of it.");
			DisableShadowConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatability", "DisableShadowConfig", false, "This is the only part of HDLethalCompany still being used.\n\nToggle to false if you want shadow settings. It may break things in certain scenarios, but you can toggle it back on if you REALLY need the extra performance.\n\nThis is the last feature that HDLCPatch does not manage itself.\n\nFeature is automatically disabled if HDLethalCompany is not found.");
			ResolutionScale = ((BaseUnityPlugin)this).Config.Bind<float>("Resolution", "ResolutionScale", 2.233f, "Resolution Scale Multiplier | 1.000 = 860x520p | 2.233 =~ 1920x1080p | 2.977 = 2560x1440p | 4.465 = 3840x2060p");
			EnableFog = ((BaseUnityPlugin)this).Config.Bind<bool>("Fog", "EnableFog", true, "Toggles fog on or off");
			FogQualityMethod = ((BaseUnityPlugin)this).Config.Bind<FogSettingMethod>("Fog", "FogQualitySettingMethod", FogSettingMethod.Presets, "Changes the method used to set fog quality.");
			FogQuality = ((BaseUnityPlugin)this).Config.Bind<FogQualitySetting>("Fog", "FogQuality", FogQualitySetting.Low, "Adjusts the fog quality. Lower values will reduce GPU load.\n\nFogQualitySettingMethod must be set to Presets.");
			FogResolutionDepthRatio = ((BaseUnityPlugin)this).Config.Bind<float>("Fog", "FogResolutionDepthRatio", 0.3f, "Affects fog quality.\n\nFogQualitySettingMethod must be set to Sliders.");
			VolumetricFogBudget = ((BaseUnityPlugin)this).Config.Bind<float>("Fog", "VolumetricFogBudget", 0.3f, "Affects fog quality.\n\nFogQualitySettingMethod must be set to Sliders.");
			ShadowQuality = ((BaseUnityPlugin)this).Config.Bind<QualitySetting>("Shadows", "ShadowQuality", QualitySetting.High, "Adjusts the shadow resolution. Lower values reduce GPU load\nFeature is disabled if HDLethalCompany is not found.");
			LODQuality = ((BaseUnityPlugin)this).Config.Bind<QualitySetting>("LOD", "LODQuality", QualitySetting.High, "Adjusts the lod (level of detail) distance. Low values reduce GPU load.");
			TextureQuality = ((BaseUnityPlugin)this).Config.Bind<QualitySetting>("TextureSettings", "TextureQuality", QualitySetting.High, "Changes texture resolution");
			EnableSteamProfileImageFix = ((BaseUnityPlugin)this).Config.Bind<bool>("TextureSettings", "SteamProfileImageFix", true, "Fixes blurry Steam profile images.");
			DisablePostProcessConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatability", "DisablePostProcessConfig", false, "Disables the toggle for post-processing effects.\nCheck this if you have an issue with post-processing.");
			EnablePostProcessing = ((BaseUnityPlugin)this).Config.Bind<bool>("PostProcessing", "EnablePostProcessing", true, "Turns on a color grading post process effect");
			EnableFoliage = ((BaseUnityPlugin)this).Config.Bind<bool>("Foliage", "EnableFoliage", true, "Toggles foliage on or off");
			EnableResolutionOverride = ((BaseUnityPlugin)this).Config.Bind<bool>("Resolution", "EnableResolutionOverride", true, "Toggles off or on overriding the vanilla resolution");
			EnableAntiAliasing = ((BaseUnityPlugin)this).Config.Bind<bool>("AntiAilasing", "EnableAntiAilasing", false, "Toggles anti-ailasing");
			DisableFoliageConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatability", "DisableFoliageConfig", false, "Disables foliage setting to prevent an issue with certain mods");
			AASetting = ((BaseUnityPlugin)this).Config.Bind<AntiAliasingSetting>("AntiAilasing", "AAMode", AntiAliasingSetting.FAA, "Changes the type of anti-ailasing used");
			ResolutionMethod = ((BaseUnityPlugin)this).Config.Bind<ResolutionSettingMethod>("Resolution", "ResolutionMethod", ResolutionSettingMethod.ScaleSlider, "Changes how resolution should be set.");
			ResolutionPresetValue = ((BaseUnityPlugin)this).Config.Bind<ResolutionPreset>("Resolution", "ResolutionPreset", ResolutionPreset.R1920x1080, "If ResolutionMethod is set to Preset, this setting will be used.");
			ResolutionWidth = ((BaseUnityPlugin)this).Config.Bind<int>("Resolution", "ResolutionWidth", 1920, "If ResolutionMethod is set to Custom, this value will be used for resolution width.");
			ResolutionHeight = ((BaseUnityPlugin)this).Config.Bind<int>("Resolution", "ResolutionHeight", 1080, "If ResolutionMethod is set to Custom, this value will be used for resolution height.");
			DisableTerminalResolutionFix = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatability", "DisableTerminalResolutionFix", false, "Check this if you have issues with the terminal text.");
			DisableTextureConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatability", "DisableTextureConfig", false, "Check this if you have issues with textures breaking.");
			DisableFogConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatability", "DisableFogConfig", false, "Check this if you have issues with fog breaking.");
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			for (int i = 0; i < assemblies.Length; i++)
			{
				if (assemblies[i].FullName.Contains("LethalConfig"))
				{
					Logger.LogInfo((object)"LethalConfig found. Setting up variables...");
					SetupLethalConfig();
					break;
				}
			}
			if (!HDLethalCompanyFound)
			{
				DisableShadowConfig.Value = true;
			}
			Logger.LogInfo((object)"Config setup complete!");
		}

		private void SetupLethalConfig()
		{
			LCHDPatchConfigSettings.Setup();
			ResolutionScale.SettingChanged += SettingsChanged;
			FogQuality.SettingChanged += SettingsChanged;
			EnableFog.SettingChanged += SettingsChanged;
			LODQuality.SettingChanged += SettingsChanged;
			ShadowQuality.SettingChanged += SettingsChanged;
			EnablePostProcessing.SettingChanged += SettingsChanged;
			EnableFoliage.SettingChanged += SettingsChanged;
			EnableResolutionOverride.SettingChanged += SettingsChanged;
			TextureQuality.SettingChanged += SettingsChanged;
			EnableSteamProfileImageFix.SettingChanged += SettingsChanged;
			EnableAntiAliasing.SettingChanged += SettingsChanged;
			AASetting.SettingChanged += SettingsChanged;
			ResolutionPresetValue.SettingChanged += SettingsChanged;
			ResolutionMethod.SettingChanged += SettingsChanged;
			ResolutionHeight.SettingChanged += SettingsChanged;
			ResolutionWidth.SettingChanged += SettingsChanged;
			FogQualityMethod.SettingChanged += SettingsChanged;
			FogResolutionDepthRatio.SettingChanged += SettingsChanged;
			VolumetricFogBudget.SettingChanged += SettingsChanged;
			DisableCatwalkRemoval.SettingChanged += SettingsChanged;
			DisableShadowConfig.SettingChanged += SettingsChanged;
			DisableResolutionConfig.SettingChanged += SettingsChanged;
			DisableLODConfig.SettingChanged += SettingsChanged;
			DisablePostProcessConfig.SettingChanged += SettingsChanged;
			DisableFogConfig.SettingChanged += SettingsChanged;
			DisableTerminalResolutionFix.SettingChanged += SettingsChanged;
			DisableTextureConfig.SettingChanged += SettingsChanged;
			Logger.LogInfo((object)"Finished setting variables for Lethal Config and setting up events");
		}

		private void SettingsChanged(object sender, EventArgs args)
		{
			Logger.LogInfo((object)"Detected settings change");
			HDLCGraphicsPatch.SettingsChanged();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "HDLethalCompanyPatch";

		public const string PLUGIN_NAME = "My first plugin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace HDLethalCompanyPatch.patches
{
	internal class HDLCGraphicsPatch
	{
		public static bool CanChangeFog = false;

		public static LayerMask DefaultCullingMask = LayerMask.op_Implicit(0);

		public static AssetBundle HDAssetBundle = null;

		public static PlayerControllerB PlayerRef;

		public static bool MaskRemoved = false;

		public static bool StartCalled = false;

		public static int RenderResolutionWidth = 1;

		public static int RenderResolutionHeight = 1;

		public static Vector2 GameResolution = new Vector2(860f, 520f);

		private const int _DefaultFontSize = 30;

		public static Vector2 OriginalScale = default(Vector2);

		public static bool OriginalScaleSet = false;

		public static float FontScale = 1f;

		public static int CurrentFontWidth = 0;

		public static void SettingsChanged()
		{
			HDLCPatch.Logger.LogInfo((object)"Applying settings changes...");
			if ((Object)(object)PlayerRef != (Object)null)
			{
				try
				{
					SetCameraData(PlayerRef);
				}
				catch (Exception ex)
				{
					HDLCPatch.Logger.LogError((object)("Failed to set camera related settings\n" + ex.ToString()));
				}
				try
				{
					SetResolution(PlayerRef);
				}
				catch (Exception ex2)
				{
					HDLCPatch.Logger.LogError((object)("Failed to set resolution\n" + ex2.ToString()));
				}
			}
			try
			{
				SetTextureQuality();
			}
			catch (Exception ex3)
			{
				HDLCPatch.Logger.LogError((object)("Failed to set texture quality\n" + ex3.ToString()));
			}
			HDLCPatch.Logger.LogInfo((object)"Settings applied");
		}

		public static void SetCameraData(PlayerControllerB player)
		{
			HDAdditionalCameraData[] array = Resources.FindObjectsOfTypeAll<HDAdditionalCameraData>();
			foreach (HDAdditionalCameraData val in array)
			{
				if (!(((Object)((Component)val).gameObject).name == "MapCamera"))
				{
					val.customRenderingSettings = true;
					SetFogQuality(val);
					TogglePostProcessing(val);
					SetLODQuality(val);
					SetShadowQuality(val);
					ToggleFoliage(val);
					if (!(((Object)((Component)val).gameObject).name == "SecurityCamera") && !(((Object)((Component)val).gameObject).name == "ShipCamera"))
					{
						SetAntiAliasing(val);
					}
				}
			}
		}

		public static void ToggleFoliage(HDAdditionalCameraData cam)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if (!HDLCPatch.DisableFoliageConfig.Value)
			{
				if (!HDLCPatch.EnableFoliage.Value)
				{
					LayerMask val = LayerMask.op_Implicit(((Component)cam).GetComponent<Camera>().cullingMask);
					val = LayerMask.op_Implicit(LayerMask.op_Implicit(val) & -1025);
					((Component)cam).GetComponent<Camera>().cullingMask = LayerMask.op_Implicit(val);
					MaskRemoved = true;
				}
				else
				{
					LayerMask val2 = LayerMask.op_Implicit(((Component)cam).GetComponent<Camera>().cullingMask);
					val2 = LayerMask.op_Implicit(LayerMask.op_Implicit(val2) | 0x400);
					((Component)cam).GetComponent<Camera>().cullingMask = LayerMask.op_Implicit(val2);
					MaskRemoved = false;
				}
			}
		}

		public static void SetLODQuality(HDAdditionalCameraData camera)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			if (!HDLCPatch.DisableLODConfig.Value)
			{
				((BitArray128)(ref camera.renderingPathCustomFrameSettingsOverrideMask.mask))[60u] = true;
				((BitArray128)(ref camera.renderingPathCustomFrameSettingsOverrideMask.mask))[61u] = true;
				((FrameSettings)(ref camera.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)60, true);
				((FrameSettings)(ref camera.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)61, true);
				camera.renderingPathCustomFrameSettings.lodBiasMode = (LODBiasMode)2;
				switch (HDLCPatch.LODQuality.Value)
				{
				case QualitySetting.VeryLow:
					camera.renderingPathCustomFrameSettings.lodBias = 0.6f;
					break;
				case QualitySetting.Low:
					camera.renderingPathCustomFrameSettings.lodBias = 0.9f;
					break;
				case QualitySetting.Medium:
					camera.renderingPathCustomFrameSettings.lodBias = 1.6f;
					break;
				case QualitySetting.High:
					camera.renderingPathCustomFrameSettings.lodBias = 2.3f;
					break;
				}
			}
		}

		public static void SetResolution(PlayerControllerB player)
		{
			//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)
			if (HDLCPatch.DisableResolutionConfig.Value)
			{
				return;
			}
			int num = 860;
			int num2 = 520;
			if (HDLCPatch.ResolutionMethod.Value == ResolutionSettingMethod.ScaleSlider)
			{
				num = (int)Math.Round(860f * HDLCPatch.ResolutionScale.Value, 0);
				num2 = (int)Math.Round(520f * HDLCPatch.ResolutionScale.Value, 0);
			}
			else if (HDLCPatch.ResolutionMethod.Value == ResolutionSettingMethod.Presets)
			{
				switch (HDLCPatch.ResolutionPresetValue.Value)
				{
				case ResolutionPreset.R640x480:
					num = 640;
					num2 = 480;
					break;
				case ResolutionPreset.R1280x720:
					num2 = 720;
					num = 1280;
					break;
				case ResolutionPreset.R1920x1080:
					num = 1920;
					num2 = 1080;
					break;
				case ResolutionPreset.R2560x1440:
					num = 2560;
					num2 = 1440;
					break;
				case ResolutionPreset.R3840x2160:
					num2 = 2160;
					num = 3840;
					break;
				}
			}
			else if (HDLCPatch.ResolutionMethod.Value == ResolutionSettingMethod.Custom)
			{
				num = HDLCPatch.ResolutionWidth.Value;
				num2 = HDLCPatch.ResolutionHeight.Value;
			}
			if (!HDLCPatch.EnableResolutionOverride.Value)
			{
				num2 = 520;
				num = 860;
			}
			RenderResolutionHeight = num2;
			RenderResolutionWidth = num;
			GameResolution = new Vector2((float)num, (float)num2);
			player.gameplayCamera.aspect = num / num2;
			player.gameplayCamera.targetTexture.Release();
			((Texture)player.gameplayCamera.targetTexture).width = num;
			((Texture)player.gameplayCamera.targetTexture).height = num2;
			player.gameplayCamera.targetTexture.Create();
		}

		public static Vector2 GetNormalizedAspectRatio(int width, int height)
		{
			//IL_0002: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			Vector2 aspectRatio = GetAspectRatio(width, height);
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor((float)width, (float)height);
			return aspectRatio / val;
		}

		public static Vector2 GetAspectRatio(int width, int height)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			int gCD = GetGCD(width, height);
			return new Vector2((float)(width / gCD), (float)(height / gCD));
		}

		public static int GetGCD(int a, int b)
		{
			while (a != 0 && b != 0)
			{
				if (a > b)
				{
					a %= b;
				}
				else
				{
					b %= a;
				}
			}
			return a | b;
		}

		public static void SetShadowQuality(HDAdditionalCameraData cam)
		{
			if (HDLCPatch.DisableShadowConfig.Value || !HDLCPatch.HDLethalCompanyFound)
			{
				return;
			}
			try
			{
				HDLCPatchProperties.SetShadowQuality.Invoke(HDLCPatchProperties.GraphicsPatchObj, new object[2] { HDAssetBundle, cam });
			}
			catch (Exception ex)
			{
				Console.WriteLine("Failed to set shadow quality HDLC reference missing...\n" + ex.ToString());
			}
		}

		public static void TogglePostProcessing(HDAdditionalCameraData camera)
		{
			if (!HDLCPatch.DisablePostProcessConfig.Value)
			{
				((BitArray128)(ref camera.renderingPathCustomFrameSettingsOverrideMask.mask))[6u] = true;
				((FrameSettings)(ref camera.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)6, HDLCPatch.EnablePostProcessing.Value);
			}
		}

		public static void SetFogQuality(HDAdditionalCameraData camera)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			if (HDLCPatch.DisableFogConfig.Value || !CanChangeFog)
			{
				return;
			}
			((BitArray128)(ref camera.renderingPathCustomFrameSettingsOverrideMask.mask))[28u] = true;
			((FrameSettings)(ref camera.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)28, HDLCPatch.EnableFog.Value);
			try
			{
				Volume[] array = Object.FindObjectsByType<Volume>((FindObjectsSortMode)0);
				BoolParameter enabled = new BoolParameter(HDLCPatch.EnableFog.Value, false);
				Fog val = default(Fog);
				for (int i = 0; i < array.Length; i++)
				{
					if (!array[i].sharedProfile.TryGet<Fog>(ref val))
					{
						continue;
					}
					val.enabled = enabled;
					((VolumeParameter<int>)(object)((VolumeComponentWithQuality)val).quality).Override(3);
					if (HDLCPatch.FogQualityMethod.Value == FogSettingMethod.Presets)
					{
						switch (HDLCPatch.FogQuality.Value)
						{
						case FogQualitySetting.Minimal:
							val.volumetricFogBudget = 0.01f;
							val.resolutionDepthRatio = 0.1f;
							break;
						case FogQualitySetting.VeryLow:
							val.volumetricFogBudget = 0.025f;
							val.resolutionDepthRatio = 0.2f;
							break;
						case FogQualitySetting.Low:
							val.volumetricFogBudget = 0.1f;
							val.resolutionDepthRatio = 0.45f;
							break;
						case FogQualitySetting.Medium:
							val.volumetricFogBudget = 0.35f;
							val.resolutionDepthRatio = 0.6f;
							break;
						case FogQualitySetting.High:
							val.volumetricFogBudget = 0.55f;
							val.resolutionDepthRatio = 0.7f;
							break;
						case FogQualitySetting.Extreme:
							val.volumetricFogBudget = 0.75f;
							val.resolutionDepthRatio = 0.8f;
							break;
						}
					}
					else
					{
						val.volumetricFogBudget = HDLCPatch.VolumetricFogBudget.Value;
						val.resolutionDepthRatio = HDLCPatch.FogResolutionDepthRatio.Value;
					}
				}
			}
			catch (Exception ex)
			{
				HDLCPatch.Logger.LogError((object)("Failed to set fog!\n" + ex.ToString()));
			}
		}

		public static void SetTextureQuality()
		{
			if (!HDLCPatch.DisableTextureConfig.Value)
			{
				QualitySettings.globalTextureMipmapLimit = (int)(3 - HDLCPatch.TextureQuality.Value);
			}
		}

		public static void SetAntiAliasing(HDAdditionalCameraData camera)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			if (HDLCPatch.EnableAntiAliasing.Value)
			{
				switch (HDLCPatch.AASetting.Value)
				{
				case AntiAliasingSetting.FAA:
					camera.antialiasing = (AntialiasingMode)1;
					break;
				case AntiAliasingSetting.TAA:
					camera.antialiasing = (AntialiasingMode)2;
					break;
				case AntiAliasingSetting.SMAA:
					camera.antialiasing = (AntialiasingMode)3;
					break;
				default:
					camera.antialiasing = (AntialiasingMode)3;
					break;
				}
			}
			else
			{
				camera.antialiasing = (AntialiasingMode)0;
			}
		}

		[HarmonyPatch(typeof(HUDManager), "GetTextureFromImage")]
		[HarmonyPostfix]
		public static Texture2D GetTextureFromImagePostfix(Texture2D __result)
		{
			if (HDLCPatch.EnableSteamProfileImageFix.Value)
			{
				__result.ignoreMipmapLimit = true;
			}
			return __result;
		}

		[HarmonyPatch(typeof(Terminal), "TextPostProcess")]
		[HarmonyPostfix]
		public static string TextPostProcessPostfix(string __result, Terminal __instance)
		{
			//IL_0039: 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)
			if (HDLCPatch.DisableResolutionConfig.Value || HDLCPatch.DisableTerminalResolutionFix.Value)
			{
				return __result;
			}
			if (!OriginalScaleSet)
			{
				OriginalScale = new Vector2((float)((Texture)__instance.playerScreenTexHighRes).width, (float)((Texture)__instance.playerScreenTexHighRes).height);
				HDLCPatch.Logger.LogInfo((object)("SCALE: " + OriginalScale.x + "|" + OriginalScale.y));
				OriginalScaleSet = true;
			}
			CurrentFontWidth = RenderResolutionWidth;
			if (((Texture)__instance.playerScreenTexHighRes).width != CurrentFontWidth)
			{
				__instance.playerScreenTexHighRes.Release();
				((Texture)__instance.playerScreenTexHighRes).height = RenderResolutionHeight;
				((Texture)__instance.playerScreenTexHighRes).width = RenderResolutionWidth;
				__instance.playerScreenTexHighRes.Create();
			}
			return __result;
		}

		[HarmonyPatch(typeof(HUDManager), "UpdateScanNodes")]
		[HarmonyPostfix]
		public static void UpdateScanNodesPostfix(PlayerControllerB playerScript, HUDManager __instance, Dictionary<RectTransform, ScanNodeProperties> ___scanNodes)
		{
			//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_0039: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			if (HDLCPatch.DisableResolutionConfig.Value)
			{
				return;
			}
			for (int i = 0; i < __instance.scanElements.Length; i++)
			{
				if (___scanNodes.TryGetValue(__instance.scanElements[i], out var value))
				{
					Vector3 val = playerScript.gameplayCamera.WorldToViewportPoint(((Component)value).transform.position);
					__instance.scanElements[i].anchoredPosition = new Vector2(-450.65f + 901.3f * val.x, -261.575f + 523.15f * val.y);
				}
			}
		}

		[HarmonyPatch(typeof(MenuManager), "SetLoadingScreen")]
		[HarmonyPrefix]
		public static void SetLoadingScreenPrefix()
		{
			StartCalled = false;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Start")]
		[HarmonyPrefix]
		public static void StartPrefix(PlayerControllerB __instance)
		{
			if (!StartCalled)
			{
				CanChangeFog = true;
				PlayerRef = __instance;
				StartCalled = true;
				SettingsChanged();
			}
		}

		[HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")]
		[HarmonyPrefix]
		public static void RoundPrefix(PlayerControllerB __instance)
		{
			CanChangeFog = false;
		}

		[HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")]
		[HarmonyPostfix]
		public static void RoundPostfix(PlayerControllerB __instance)
		{
			CanChangeFog = true;
			SettingsChanged();
			if (HDLCPatch.LODQuality.Value == QualitySetting.VeryLow && !HDLCPatch.DisableCatwalkRemoval.Value)
			{
				HDLCPatch.Logger.LogInfo((object)"Removing catwalk stairs lod");
				RemoveLOD("CatwalkStairs");
			}
		}

		public static void RemoveLOD(string name)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			Object[] array = Resources.FindObjectsOfTypeAll(typeof(LODGroup));
			for (int i = 0; i < array.Length; i++)
			{
				LODGroup val = (LODGroup)array[i];
				if (((Object)((Component)val).gameObject).name == name)
				{
					val.enabled = false;
				}
			}
		}
	}
	[HarmonyPatch]
	internal class HDLCSetFogQualityPatch
	{
		private static MethodBase TargetMethod()
		{
			return AccessTools.Method(AccessTools.TypeByName("HDLethalCompany.Patch.GraphicsPatch"), "SetFogQuality", (Type[])null, (Type[])null);
		}

		public static void Prefix(object __instance)
		{
		}
	}
}
namespace HDLethalCompanyPatch.config
{
	public static class LCHDPatchConfigSettings
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static GenericButtonHandler <>9__29_0;

			internal void <Setup>b__29_0()
			{
				HDLCGraphicsPatch.SettingsChanged();
			}
		}

		public static EnumDropDownConfigItem<QualitySetting> ShadowQualityItem;

		public static EnumDropDownConfigItem<QualitySetting> LODQualityItem;

		public static EnumDropDownConfigItem<QualitySetting> TextureQualityItem;

		public static EnumDropDownConfigItem<FogQualitySetting> FogQualityItem;

		public static EnumDropDownConfigItem<AntiAliasingSetting> AASettingItem;

		public static EnumDropDownConfigItem<ResolutionSettingMethod> ResolutionMethodItem;

		public static EnumDropDownConfigItem<ResolutionPreset> ResolutionPresetItem;

		public static EnumDropDownConfigItem<FogSettingMethod> FogSettingMethodItem;

		public static FloatSliderConfigItem ResolutionScaleItem;

		public static FloatSliderConfigItem VolumetricFogBudgetItem;

		public static FloatSliderConfigItem FogResolutionDepthRatioItem;

		public static FloatSliderConfigItem FontScaleItem;

		public static IntInputFieldConfigItem ResolutionWidthItem;

		public static IntInputFieldConfigItem ResolutionHeightItem;

		public static BoolCheckBoxConfigItem EnableFogItem;

		public static BoolCheckBoxConfigItem EnablePostProcessingItem;

		public static BoolCheckBoxConfigItem EnableFoliageItem;

		public static BoolCheckBoxConfigItem EnableResolutionOverrideItem;

		public static BoolCheckBoxConfigItem EnableAntiAliasingItem;

		public static BoolCheckBoxConfigItem DisableFoliageConfigItem;

		public static BoolCheckBoxConfigItem EnableSteamProfileImageFixItem;

		public static BoolCheckBoxConfigItem DisableCatwalkRemovalItem;

		public static BoolCheckBoxConfigItem DisableShadowsConfigItem;

		public static BoolCheckBoxConfigItem DisableLODConfigItem;

		public static BoolCheckBoxConfigItem DisableResolutionConfigItem;

		public static BoolCheckBoxConfigItem DisablePostProcessConfigItem;

		public static BoolCheckBoxConfigItem DisableTextureConfigItem;

		public static BoolCheckBoxConfigItem DisableFogConfigItem;

		public static BoolCheckBoxConfigItem DisableTerminalFixItem;

		public static void Setup()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_0097: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Expected O, but got Unknown
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Expected O, but got Unknown
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Expected O, but got Unknown
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Expected O, but got Unknown
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Expected O, but got Unknown
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Expected O, but got Unknown
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Expected O, but got Unknown
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Expected O, but got Unknown
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Expected O, but got Unknown
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Expected O, but got Unknown
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Expected O, but got Unknown
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Expected O, but got Unknown
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Expected O, but got Unknown
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Expected O, but got Unknown
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Expected O, but got Unknown
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Expected O, but got Unknown
			LethalConfigManager.SetModDescription("A patch mod for HDLethalCompany that also includes runtime configs through LethalConfig");
			ConfigEntry<float> resolutionScale = HDLCPatch.ResolutionScale;
			FloatSliderOptions val = new FloatSliderOptions();
			((BaseRangeOptions<float>)val).Max = 4.465f;
			((BaseRangeOptions<float>)val).Min = 0.25f;
			((BaseOptions)val).RequiresRestart = false;
			ResolutionScaleItem = new FloatSliderConfigItem(resolutionScale, val);
			EnableFogItem = new BoolCheckBoxConfigItem(HDLCPatch.EnableFog, false);
			FogSettingMethodItem = new EnumDropDownConfigItem<FogSettingMethod>(HDLCPatch.FogQualityMethod, false);
			FogQualityItem = new EnumDropDownConfigItem<FogQualitySetting>(HDLCPatch.FogQuality, false);
			ConfigEntry<float> fogResolutionDepthRatio = HDLCPatch.FogResolutionDepthRatio;
			FloatSliderOptions val2 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val2).Max = 1f;
			((BaseRangeOptions<float>)val2).Min = 0.01f;
			((BaseOptions)val2).RequiresRestart = false;
			FogResolutionDepthRatioItem = new FloatSliderConfigItem(fogResolutionDepthRatio, val2);
			ConfigEntry<float> volumetricFogBudget = HDLCPatch.VolumetricFogBudget;
			FloatSliderOptions val3 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val3).Min = 0.01f;
			((BaseRangeOptions<float>)val3).Max = 1f;
			((BaseOptions)val3).RequiresRestart = false;
			VolumetricFogBudgetItem = new FloatSliderConfigItem(volumetricFogBudget, val3);
			ShadowQualityItem = new EnumDropDownConfigItem<QualitySetting>(HDLCPatch.ShadowQuality, false);
			LODQualityItem = new EnumDropDownConfigItem<QualitySetting>(HDLCPatch.LODQuality, false);
			EnablePostProcessingItem = new BoolCheckBoxConfigItem(HDLCPatch.EnablePostProcessing, false);
			EnableFoliageItem = new BoolCheckBoxConfigItem(HDLCPatch.EnableFoliage, false);
			EnableResolutionOverrideItem = new BoolCheckBoxConfigItem(HDLCPatch.EnableResolutionOverride, false);
			EnableAntiAliasingItem = new BoolCheckBoxConfigItem(HDLCPatch.EnableAntiAliasing, false);
			TextureQualityItem = new EnumDropDownConfigItem<QualitySetting>(HDLCPatch.TextureQuality, false);
			DisableFoliageConfigItem = new BoolCheckBoxConfigItem(HDLCPatch.DisableFoliageConfig, true);
			AASettingItem = new EnumDropDownConfigItem<AntiAliasingSetting>(HDLCPatch.AASetting, false);
			ResolutionMethodItem = new EnumDropDownConfigItem<ResolutionSettingMethod>(HDLCPatch.ResolutionMethod, false);
			ResolutionPresetItem = new EnumDropDownConfigItem<ResolutionPreset>(HDLCPatch.ResolutionPresetValue, false);
			ResolutionHeightItem = new IntInputFieldConfigItem(HDLCPatch.ResolutionHeight, false);
			ResolutionWidthItem = new IntInputFieldConfigItem(HDLCPatch.ResolutionWidth, false);
			EnableSteamProfileImageFixItem = new BoolCheckBoxConfigItem(HDLCPatch.EnableSteamProfileImageFix, false);
			DisableCatwalkRemovalItem = new BoolCheckBoxConfigItem(HDLCPatch.DisableCatwalkRemoval, false);
			DisableShadowsConfigItem = new BoolCheckBoxConfigItem(HDLCPatch.DisableShadowConfig, true);
			DisableResolutionConfigItem = new BoolCheckBoxConfigItem(HDLCPatch.DisableResolutionConfig, true);
			DisableLODConfigItem = new BoolCheckBoxConfigItem(HDLCPatch.DisableLODConfig, true);
			DisablePostProcessConfigItem = new BoolCheckBoxConfigItem(HDLCPatch.DisablePostProcessConfig, true);
			DisableTextureConfigItem = new BoolCheckBoxConfigItem(HDLCPatch.DisableTextureConfig, true);
			DisableTerminalFixItem = new BoolCheckBoxConfigItem(HDLCPatch.DisableTerminalResolutionFix, true);
			DisableFogConfigItem = new BoolCheckBoxConfigItem(HDLCPatch.DisableFogConfig, true);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)DisableResolutionConfigItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)DisableFogConfigItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)DisableTerminalFixItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)DisableTextureConfigItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)EnableResolutionOverrideItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)ResolutionMethodItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)ResolutionScaleItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)ResolutionPresetItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)ResolutionWidthItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)ResolutionHeightItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)FogSettingMethodItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)FogQualityItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)FogResolutionDepthRatioItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)VolumetricFogBudgetItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)DisableShadowsConfigItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)ShadowQualityItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)DisableLODConfigItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)LODQualityItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)DisableCatwalkRemovalItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)TextureQualityItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)EnableSteamProfileImageFixItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)DisablePostProcessConfigItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)EnablePostProcessingItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)EnableFogItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)EnableFoliageItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)EnableAntiAliasingItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)DisableFoliageConfigItem);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)AASettingItem);
			object obj = <>c.<>9__29_0;
			if (obj == null)
			{
				GenericButtonHandler val4 = delegate
				{
					HDLCGraphicsPatch.SettingsChanged();
				};
				<>c.<>9__29_0 = val4;
				obj = (object)val4;
			}
			LethalConfigManager.AddConfigItem((BaseConfigItem)new GenericButtonConfigItem("Commands", "ForceSettingsChange", "Makes a call to HDLC to run a settings change event. \nUse this if internal references failed to set on first change", "Force Change Settings", (GenericButtonHandler)obj));
		}
	}
}