Decompiled source of GraphicsConfigPlus v1.3.1

plugins\GraphicsConfigPlus.dll

Decompiled 3 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
using UnityEngine.PostProcessing;
using UnityEngine.SceneManagement;
using UnityStandardAssets.ImageEffects;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.3.1")]
[assembly: AssemblyInformationalVersion("1.0.0+bcf1d307d66620aa503f13cb80b965ad80ed91a2")]
[assembly: AssemblyVersion("1.3.1.0")]
namespace GraphicsConfigPlus;

[HarmonyPatch]
public class HiddenSettings
{
	public static void OnReload()
	{
		ApplyShadowSettings();
		ApplyQualityOverrides();
		ApplyVSync();
		ApplyMaxFps();
	}

	[HarmonyPatch(typeof(GraphicsSettingsManager), "ApplyQualitySettings")]
	[HarmonyPostfix]
	private static void ApplyQualitySettings_Postfix()
	{
		ApplyShadowSettings();
		ApplyQualityOverrides();
	}

	[HarmonyPatch(typeof(GraphicsSettingsManager), "ApplyGraphicsSettingsToCurrentSession")]
	[HarmonyPostfix]
	private static void ApplyGraphicsSettingsToCurrentSession_Postfix()
	{
		ApplyShadowSettings();
		ApplyQualityOverrides();
		ApplyVSync();
	}

	[HarmonyPatch(typeof(GraphicsSettingsManager), "ApplyStartupSettings")]
	[HarmonyPostfix]
	private static void GraphicsSettingsManager_ApplyStartupSettings()
	{
		ApplyVSync();
	}

	[HarmonyPatch(typeof(Settings), "ApplyStartupSettings")]
	[HarmonyPostfix]
	private static void Settings_ApplyStartupSettings()
	{
		ApplyVSync();
	}

	[HarmonyPatch(typeof(Game), "Start")]
	[HarmonyPostfix]
	private static void Game_Start()
	{
		ApplyMaxFps();
	}

	private static void ApplyShadowSettings()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		if (Main.printValues.Value)
		{
			Debug.Log((object)"[GraphicsConfigPlus] ----Shadow settings----");
			Debug.Log((object)$"shadowResolution: {QualitySettings.shadowResolution} to {(object)(ShadowResolution)Main.shadowResolution.Value}");
			Debug.Log((object)$"shadowCascades: {QualitySettings.shadowCascades} to {Main.shadowCascades.Value}");
			Debug.Log((object)$"shadowDistance: {QualitySettings.shadowDistance} to {Main.shadowDistance.Value}");
			Debug.Log((object)$"shadows: {QualitySettings.shadows} to {(object)(ShadowQuality)Main.shadows.Value}");
		}
		QualitySettings.shadowCascades = Main.shadowCascades.Value;
		QualitySettings.shadowDistance = Main.shadowDistance.Value;
		QualitySettings.shadows = (ShadowQuality)Main.shadows.Value;
		QualitySettings.shadowResolution = (ShadowResolution)Main.shadowResolution.Value;
	}

	private static void ApplyQualityOverrides()
	{
		//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: Invalid comparison between Unknown and I4
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Invalid comparison between Unknown and I4
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		if (Main.printValues.Value)
		{
			Debug.Log((object)"[GraphicsConfigPlus] ----General settings----");
			Debug.Log((object)$"AnisotropicFiltering: {QualitySettings.anisotropicFiltering} to {(object)(AnisotropicFiltering)Main.anisotropicFiltering.Value}");
			Debug.Log((object)$"MasterTextureLimit/globalTextureMipmapLimit: {QualitySettings.globalTextureMipmapLimit} to {Main.masterTextureLimit.Value}");
			if ((int)SystemInfo.graphicsDeviceType != 21)
			{
				Debug.Log((object)$"MaxQueuedFrames: {QualitySettings.maxQueuedFrames} to {Main.maxQueuedFrames.Value}");
			}
			else
			{
				Debug.Log((object)"Vulkan detected, not applying MaxQueuedFrames setting");
			}
			Debug.Log((object)$"ParticleRaycastBudget: {QualitySettings.particleRaycastBudget} to {Main.particleRaycastBudget.Value}");
			Debug.Log((object)$"PixelLightCount: {QualitySettings.pixelLightCount} to {Main.pixelLightCount.Value}");
			Debug.Log((object)$"RealtimeReflectionProbes: {QualitySettings.realtimeReflectionProbes} to {Main.realtimeReflectionProbes.Value}");
			Debug.Log((object)$"SkinWeights: {QualitySettings.skinWeights} to {(object)(SkinWeights)Main.skinWeights.Value}");
			Debug.Log((object)$"SoftParticles: {QualitySettings.softParticles} to {Main.softParticles.Value}");
			Debug.Log((object)$"SoftVegetation: {QualitySettings.softVegetation} to {Main.softVegetation.Value}");
			Debug.Log((object)$"LodBias: {QualitySettings.lodBias} to {Main.lodBias.Value}");
		}
		QualitySettings.anisotropicFiltering = (AnisotropicFiltering)Main.anisotropicFiltering.Value;
		QualitySettings.lodBias = Main.lodBias.Value;
		QualitySettings.globalTextureMipmapLimit = Main.masterTextureLimit.Value;
		if ((int)SystemInfo.graphicsDeviceType != 21)
		{
			QualitySettings.maxQueuedFrames = Main.maxQueuedFrames.Value;
		}
		QualitySettings.particleRaycastBudget = Main.particleRaycastBudget.Value;
		QualitySettings.pixelLightCount = Main.pixelLightCount.Value;
		QualitySettings.realtimeReflectionProbes = Main.realtimeReflectionProbes.Value;
		QualitySettings.skinWeights = (SkinWeights)Main.skinWeights.Value;
		QualitySettings.softParticles = Main.softParticles.Value;
		QualitySettings.softVegetation = Main.softVegetation.Value;
	}

	private static void ApplyVSync()
	{
		if (Main.printValues.Value)
		{
			Debug.Log((object)$"[GraphicsConfigPlus] vSyncCount: {QualitySettings.vSyncCount} to {Main.vSyncCount.Value}");
		}
		QualitySettings.vSyncCount = Main.vSyncCount.Value;
	}

	private static void ApplyMaxFps()
	{
		if (Main.printValues.Value)
		{
			Debug.Log((object)$"[GraphicsConfigPlus] MaxFPS: {Application.targetFrameRate} to {Main.maxFps.Value}");
		}
		Application.targetFrameRate = Main.maxFps.Value;
	}
}
[BepInPlugin("cjayride.GraphicsConfigPlus", "GraphicsConfigPlus", "1.3.1")]
public class Main : BaseUnityPlugin
{
	internal readonly Harmony harmony = new Harmony("cjayride.GraphicsConfigPlus");

	public readonly int nexusID = 351;

	public static ConfigEntry<bool> modEnabled { get; private set; }

	public static ConfigEntry<bool> printValues { get; private set; }

	public static ConfigEntry<int> anisotropicFiltering { get; private set; }

	public static ConfigEntry<int> masterTextureLimit { get; private set; }

	public static ConfigEntry<int> maxQueuedFrames { get; private set; }

	public static ConfigEntry<int> particleRaycastBudget { get; private set; }

	public static ConfigEntry<int> pixelLightCount { get; private set; }

	public static ConfigEntry<bool> realtimeReflectionProbes { get; private set; }

	public static ConfigEntry<int> skinWeights { get; private set; }

	public static ConfigEntry<bool> softParticles { get; private set; }

	public static ConfigEntry<bool> softVegetation { get; private set; }

	public static ConfigEntry<float> lodBias { get; private set; }

	public static ConfigEntry<int> shadowResolution { get; private set; }

	public static ConfigEntry<int> shadowCascades { get; private set; }

	public static ConfigEntry<float> shadowDistance { get; private set; }

	public static ConfigEntry<int> shadows { get; private set; }

	public static ConfigEntry<bool> disablePostProcessing { get; private set; }

	public static ConfigEntry<float> lensDirtIntensity { get; private set; }

	public static ConfigEntry<float> sunShaftsIntensity { get; private set; }

	public static ConfigEntry<int> sunShaftsResolution { get; private set; }

	public static ConfigEntry<int> sunShaftsScreenBlendMode { get; private set; }

	public static ConfigEntry<float> sunShaftsMaxRadius { get; private set; }

	public static ConfigEntry<float> sunShaftsBlurRadius { get; private set; }

	public static ConfigEntry<int> sunShaftsRadialBlurIterations { get; private set; }

	public static ConfigEntry<bool> bloomAntiFlicker { get; private set; }

	public static ConfigEntry<float> bloomRadious { get; private set; }

	public static ConfigEntry<float> bloomSoftKnee { get; private set; }

	public static ConfigEntry<float> bloomIntensity { get; private set; }

	public static ConfigEntry<Color> gammaCorrection { get; private set; }

	public static ConfigEntry<float> SSAOintensity { get; private set; }

	public static ConfigEntry<bool> SSAOhighPrecision { get; private set; }

	public static ConfigEntry<bool> SSAOambientOnly { get; private set; }

	public static ConfigEntry<bool> SSAOdownSampling { get; private set; }

	public static ConfigEntry<float> SSAOfarDistance { get; private set; }

	public static ConfigEntry<int> SSAOsampleCount { get; private set; }

	public static ConfigEntry<float> MBframeBlending { get; private set; }

	public static ConfigEntry<int> MBsampleCount { get; private set; }

	public static ConfigEntry<float> MBshutterAngle { get; private set; }

	public static ConfigEntry<int> AAmethod { get; private set; }

	public static ConfigEntry<float> CAintensity { get; private set; }

	public static ConfigEntry<int> maxFps { get; private set; }

	public static ConfigEntry<int> vSyncCount { get; private set; }

	public static ConfigEntry<string> reloadKey { get; private set; }

	public static ConfigEntry<bool> fog { get; private set; }

	public static ConfigEntry<Color> fogColor { get; private set; }

	public static ConfigEntry<float> fogDensity { get; private set; }

	public static ConfigEntry<float> fogStartDistance { get; private set; }

	public static ConfigEntry<float> fogEndDistance { get; private set; }

	public static ConfigEntry<int> fogMode { get; private set; }

	private void Awake()
	{
		LoadValues();
		if (modEnabled.Value)
		{
			harmony.PatchAll(typeof(HiddenSettings));
			harmony.PatchAll(typeof(PostProcessing));
			((BaseUnityPlugin)this).Config.ConfigReloaded += OnReloaded;
		}
	}

	private void Update()
	{
		if (modEnabled.Value && Input.GetKeyDown(reloadKey.Value))
		{
			Debug.Log((object)"[GraphicsConfigPlus] Reloading config");
			((BaseUnityPlugin)this).Config.Reload();
		}
	}

	private void OnReloaded(object sender, EventArgs e)
	{
		HiddenSettings.OnReload();
		PostProcessing.OnReload();
	}

	private void LoadValues()
	{
		//IL_048a: Unknown result type (might be due to invalid IL or missing references)
		//IL_052a: Unknown result type (might be due to invalid IL or missing references)
		modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable this mod");
		((BaseUnityPlugin)this).Config.Bind<int>("General", "NexusID", nexusID, "Nexus mod ID for updates");
		printValues = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "PrintDefaultValues", false, "Whether to print the game's graphics configuration before the mod loads.");
		reloadKey = ((BaseUnityPlugin)this).Config.Bind<string>("General", "ReloadKey", "home", "Key used to reload mod config file.");
		anisotropicFiltering = ((BaseUnityPlugin)this).Config.Bind<int>("General", "AnisotropicFiltering", 2, "Set Anisotropic Filtering. 0 - Disabled, 1 - Enabled, 2 - Forced");
		masterTextureLimit = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MasterTextureLimit", 0, "A texture size limit applied to all textures. 1 will halve texture size, 2 will quarter it, and so on. 0 disables this setting.");
		maxQueuedFrames = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxQueuedFrames", 2, "Increasing it can smooth the fps a little, but can introduce input lag. Ignored when using Vulkan");
		particleRaycastBudget = ((BaseUnityPlugin)this).Config.Bind<int>("General", "ParticleRaycastBudget", 4096, "Budget for how many ray casts can be performed per frame for approximate collision testing.");
		pixelLightCount = ((BaseUnityPlugin)this).Config.Bind<int>("General", "PixelLightCount", 8, "The maximum number of pixel lights that should affect any object.");
		realtimeReflectionProbes = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RealtimeReflectionProbes", true, "Enables realtime reflection probes. If disabled, there will be no reflections in the game.");
		skinWeights = ((BaseUnityPlugin)this).Config.Bind<int>("General", "SkinWeights", 2, "The maximum number of bone weights that can affect a vertex, for all skinned meshes in the project. 0 - One bone, 1 - Two bones, 2 - Four bones, 3 - Unlimited");
		softParticles = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "SoftParticles", true, "Whether soft blending should be used for particles");
		softVegetation = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "SoftVegetation", true, "If enabled, vegetation will have smoothed edges; if disabled all plants will have hard edges but are rendered roughly twice as fast.");
		lodBias = ((BaseUnityPlugin)this).Config.Bind<float>("General", "LodBias", 5f, "Global multiplier for the LOD's switching distance. A larger value leads to a longer view distance before a lower resolution LOD is picked.");
		vSyncCount = ((BaseUnityPlugin)this).Config.Bind<int>("General", "vSyncCount", 0, "Set if vSync should be used. 0 is disabled and 1 is enabled. You also can use 2, 3 or 4 to enable vSync but cut the max FPS.");
		maxFps = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxFPS", -1, "Set the target fps. Use -1 to set the FPS based on screen refresh rate. This setting only works if vSyncCount is 0.");
		shadowResolution = ((BaseUnityPlugin)this).Config.Bind<int>("Shadows", "ShadowResolution", 2, "0 - Low, 1 - Medium, 2 - High, 3 - VeryHigh");
		shadowCascades = ((BaseUnityPlugin)this).Config.Bind<int>("Shadows", "ShadowCascades", 4, "Number of cascades to use for directional light shadows.");
		shadowDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Shadows", "ShadowDistance", 150f, "Shadow drawing distance.");
		shadows = ((BaseUnityPlugin)this).Config.Bind<int>("Shadows", "Shadows", 1, "Shadow quality: 0 - Disabled, 1 - Only hard shadows, 2 - All");
		disablePostProcessing = ((BaseUnityPlugin)this).Config.Bind<bool>("PostProcessing", "DisablePostProcessing", false, "Disable all post-processing effects. (Includes SSAO and antialiasing)");
		fog = ((BaseUnityPlugin)this).Config.Bind<bool>("PostProcessing", "Fog", true, "");
		sunShaftsResolution = ((BaseUnityPlugin)this).Config.Bind<int>("PostProcessing", "SunShaftsResolution", 1, "Changes SunShafts resolution. 0 - Low, 1 - Normal, 2 - High");
		sunShaftsScreenBlendMode = ((BaseUnityPlugin)this).Config.Bind<int>("PostProcessing", "SunShaftsScreenBlendMode", 0, "Changes SunShafts blending method. 0 - Screen, 1 - Add (fastest)");
		bloomAntiFlicker = ((BaseUnityPlugin)this).Config.Bind<bool>("PostProcessing", "BloomAntiFlicker", true, "Reduces flashing noise with an additional filter");
		SSAOdownSampling = ((BaseUnityPlugin)this).Config.Bind<bool>("PostProcessing", "AOdownSampling", false, "Reduces the effect quality to gain some performance");
		SSAOfarDistance = ((BaseUnityPlugin)this).Config.Bind<float>("PostProcessing", "AOfarDistance", 150f, "How far the effect is applied in the screen");
		SSAOsampleCount = ((BaseUnityPlugin)this).Config.Bind<int>("PostProcessing", "AOsampleCount", 10, "Lowest = 3, Low = 6, Medium = 10, High = 16");
		SSAOhighPrecision = ((BaseUnityPlugin)this).Config.Bind<bool>("PostProcessing", "AOhighPrecision", false, "Increase effect quality at cost of performance");
		AAmethod = ((BaseUnityPlugin)this).Config.Bind<int>("PostProcessing", "AA_Method", 1, "Fxaa - 0, Taa - 1");
		bloomIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Flavor", "BloomIntensity", 0.3f, "Strength of the Bloom filter");
		bloomRadious = ((BaseUnityPlugin)this).Config.Bind<float>("Flavor", "BloomRadious", 5f, "Changes extent of bloom veiling effects");
		lensDirtIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Flavor", "LensDirtIntensity", 10.4f, "Amount of bloom lens dirtiness");
		sunShaftsIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Flavor", "SunShaftsIntensity", 1f, "The brightness of the sun shafts");
		gammaCorrection = ((BaseUnityPlugin)this).Config.Bind<Color>("Flavor", "GammaCorrection", new Color(1f, 1f, 1f, 0f), "Hexadecimal color to apply over screen. Format RRGGBBAA, with AA being the intensity.");
		SSAOintensity = ((BaseUnityPlugin)this).Config.Bind<float>("Flavor", "AOintensity", 1f, "Adjust the degree of darkness Ambient Occlusion produces.");
		SSAOambientOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Flavor", "AOambientOnly", false, "Make the Ambient Occlusion effect only affect ambient lighting.");
		CAintensity = ((BaseUnityPlugin)this).Config.Bind<float>("Flavor", "ChromaticAberrationIntensity", 0.15f, "Strength of chromatic aberrations");
		fogColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Flavor", "FogColor", new Color(0.487f, 0.57f, 0.669f, 1f), "The color of the fog.");
		fogDensity = ((BaseUnityPlugin)this).Config.Bind<float>("Flavor", "FogDensity", 0.1f, "The density of the exponential fog.");
		fogStartDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Flavor", "FogStartDistance", 300f, "The starting distance of linear fog.");
		fogEndDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Flavor", "FogEndDistance", 900f, "The ending distance of linear fog.");
		fogMode = ((BaseUnityPlugin)this).Config.Bind<int>("Flavor", "FogMode", 2, "1 - Linear, 2 - Exponential, 3 - ExponentialSquared");
		sunShaftsMaxRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "SunShaftsMaxRadius", 0.4f, "How far the sun shafts go");
		sunShaftsBlurRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "SunShaftsBlurRadius", 3f, "The radius over which pixel colours are combined during blurring.");
		sunShaftsRadialBlurIterations = ((BaseUnityPlugin)this).Config.Bind<int>("Advanced", "SunShaftsRadialBlurIterations", 3, "Increase to get smoother blurring at performance cost or decrease to get a fast and sharper effect");
		bloomSoftKnee = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "BloomSoftKnee", 0.7f, "Makes transition between under/over-threshold gradual (0 = hard threshold, 1 = soft threshold)");
		MBframeBlending = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "MotionBlurFrameBlending", 0f, "");
		MBsampleCount = ((BaseUnityPlugin)this).Config.Bind<int>("Advanced", "MotionBlurSampleCount", 10, "Set the value for the amount of sample points. Less is faster, more is smoother");
		MBshutterAngle = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "MotionBlurShutterAngle", 150f, "Set the angle of the rotary shutter. Larger values give longer exposure and a stronger blur effect.");
	}
}
[HarmonyPatch]
public static class PostProcessing
{
	private static PostProcessingBehaviour postProcessingBehaviour;

	private static CameraEffects cameraEffects;

	public static void OnReload()
	{
		SetBloom();
		SetSunShafts(cameraEffects);
		SetSSAO();
		SetMotionBlur();
		SetAntiAliasing();
		SetCA();
		PostApplySettings();
	}

	[HarmonyPatch(typeof(CameraEffects), "Awake")]
	[HarmonyPrefix]
	private static void Awake(CameraEffects __instance, PostProcessingBehaviour ___m_postProcessing)
	{
		cameraEffects = __instance;
		postProcessingBehaviour = ___m_postProcessing ?? ((Component)__instance).GetComponent<PostProcessingBehaviour>();
	}

	[HarmonyPatch(typeof(CameraEffects), "ApplySettings")]
	[HarmonyPostfix]
	private static void PostApplySettings()
	{
		//IL_0040: 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)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: 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_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//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_007b: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)postProcessingBehaviour == (Object)null) && !((Object)(object)postProcessingBehaviour.profile == (Object)null) && postProcessingBehaviour.profile.colorGrading != null)
		{
			Settings settings = postProcessingBehaviour.profile.colorGrading.settings;
			if (Main.printValues.Value)
			{
				Debug.Log((object)"[GraphicsConfigPlus] ----Misc----");
				Debug.Log((object)$"GammaCorrection: {settings.colorWheels.linear.gamma} to {Main.gammaCorrection.Value}");
			}
			settings.colorWheels.linear.gamma = Main.gammaCorrection.Value;
			postProcessingBehaviour.profile.colorGrading.settings = settings;
			ApplyFogSettings();
			((Behaviour)postProcessingBehaviour).enabled = !Main.disablePostProcessing.Value;
		}
	}

	private static void ApplyFogSettings()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)postProcessingBehaviour == (Object)null || (Object)(object)postProcessingBehaviour.profile == (Object)null)
		{
			return;
		}
		Scene activeScene = SceneManager.GetActiveScene();
		if (!(((Scene)(ref activeScene)).name == "start"))
		{
			if (Main.printValues.Value)
			{
				Debug.Log((object)$"FogColor: {RenderSettings.fogColor} to {Main.fogColor.Value}");
				Debug.Log((object)$"FogDensity: {RenderSettings.fogDensity} to {Main.fogDensity.Value}");
				Debug.Log((object)$"FogStartDistance: {RenderSettings.fogStartDistance} to {Main.fogStartDistance.Value}");
				Debug.Log((object)$"FogEndDistance: {RenderSettings.fogEndDistance} to {Main.fogEndDistance.Value}");
				Debug.Log((object)$"FogMode: {RenderSettings.fogMode} to {(object)(FogMode)Main.fogMode.Value}");
				Debug.Log((object)$"Fog: {((PostProcessingModel)postProcessingBehaviour.profile.fog).enabled} to {Main.fog.Value}");
			}
			RenderSettings.fogColor = Main.fogColor.Value;
			RenderSettings.fogDensity = Main.fogDensity.Value;
			RenderSettings.fogStartDistance = Main.fogStartDistance.Value;
			RenderSettings.fogEndDistance = Main.fogEndDistance.Value;
			RenderSettings.fogMode = (FogMode)Main.fogMode.Value;
			((PostProcessingModel)postProcessingBehaviour.profile.fog).enabled = Main.fog.Value;
		}
	}

	[HarmonyPatch(typeof(CameraEffects), "SetSunShafts", new Type[] { typeof(bool) })]
	[HarmonyPrefix]
	private static void SetSunShafts(CameraEffects __instance)
	{
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: 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_007a: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)__instance != (Object)null)
		{
			cameraEffects = __instance;
		}
		if ((Object)(object)cameraEffects == (Object)null)
		{
			return;
		}
		SunShafts component = ((Component)cameraEffects).GetComponent<SunShafts>();
		if (!((Object)(object)component == (Object)null))
		{
			if (Main.printValues.Value)
			{
				Debug.Log((object)"[GraphicsConfigPlus] ----SunShafts settings----");
				Debug.Log((object)$"SunShaftsResolution: {component.resolution} to {(object)(SunShaftsResolution)Main.sunShaftsResolution.Value}");
				Debug.Log((object)$"SunShaftsScreenBlendMode: {component.screenBlendMode} to {(object)(ShaftsScreenBlendMode)Main.sunShaftsScreenBlendMode.Value}");
				Debug.Log((object)$"SunShaftsMaxRadius: {component.maxRadius} to {Main.sunShaftsMaxRadius.Value}");
				Debug.Log((object)$"SunShaftsBlurRadius: {component.sunShaftBlurRadius} to {Main.sunShaftsBlurRadius.Value}");
				Debug.Log((object)$"SunShaftsBlurIterations: {component.radialBlurIterations} to {Main.sunShaftsRadialBlurIterations.Value}");
				Debug.Log((object)$"SunShaftsIntensity: {component.sunShaftIntensity} to {Main.sunShaftsIntensity.Value}");
			}
			component.resolution = (SunShaftsResolution)Main.sunShaftsResolution.Value;
			component.screenBlendMode = (ShaftsScreenBlendMode)Main.sunShaftsScreenBlendMode.Value;
			component.maxRadius = Main.sunShaftsMaxRadius.Value;
			component.sunShaftBlurRadius = Main.sunShaftsBlurRadius.Value;
			component.radialBlurIterations = Main.sunShaftsRadialBlurIterations.Value;
			component.sunShaftIntensity = Main.sunShaftsIntensity.Value;
		}
	}

	[HarmonyPatch(typeof(CameraEffects), "SetBloom", new Type[] { typeof(bool) })]
	[HarmonyPrefix]
	private static void SetBloom()
	{
		//IL_0040: 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)
		//IL_01c2: 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_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: 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_011d: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)postProcessingBehaviour == (Object)null) && !((Object)(object)postProcessingBehaviour.profile == (Object)null) && postProcessingBehaviour.profile.bloom != null)
		{
			Settings settings = postProcessingBehaviour.profile.bloom.settings;
			if (Main.printValues.Value)
			{
				Debug.Log((object)"[GraphicsConfigPlus] ----Bloom settings----");
				Debug.Log((object)$"BloomIntensity: {settings.bloom.intensity} to {Main.bloomIntensity.Value}");
				Debug.Log((object)$"BloomAntiFlicker: {settings.bloom.antiFlicker} to {Main.bloomAntiFlicker.Value}");
				Debug.Log((object)$"BloomRadious: {settings.bloom.radius} to {Main.bloomRadious.Value}");
				Debug.Log((object)$"BloomSoftKnee: {settings.bloom.softKnee} to {Main.bloomSoftKnee.Value}");
				Debug.Log((object)$"LensDirtIntensity: {settings.lensDirt.intensity} to {Main.lensDirtIntensity.Value}");
			}
			settings.bloom.intensity = Main.bloomIntensity.Value;
			settings.bloom.antiFlicker = Main.bloomAntiFlicker.Value;
			settings.bloom.radius = Main.bloomRadious.Value;
			settings.bloom.softKnee = Main.bloomSoftKnee.Value;
			settings.lensDirt.intensity = Main.lensDirtIntensity.Value;
			postProcessingBehaviour.profile.bloom.settings = settings;
		}
	}

	[HarmonyPatch(typeof(CameraEffects), "SetSSAO", new Type[] { typeof(int) })]
	[HarmonyPostfix]
	private static void SetSSAO()
	{
		//IL_0040: 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)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ca: 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_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)postProcessingBehaviour == (Object)null) && !((Object)(object)postProcessingBehaviour.profile == (Object)null) && postProcessingBehaviour.profile.ambientOcclusion != null)
		{
			Settings settings = postProcessingBehaviour.profile.ambientOcclusion.settings;
			if (Main.printValues.Value)
			{
				Debug.Log((object)"[GraphicsConfigPlus] ----Ambient Occlusion settings----");
				Debug.Log((object)$"SSAOintensity: {settings.intensity} to {Main.SSAOintensity.Value}");
				Debug.Log((object)$"SSAOhighPrecision: {settings.highPrecision} to {Main.SSAOhighPrecision.Value}");
				Debug.Log((object)$"SSAOambientOnly: {settings.ambientOnly} to {Main.SSAOambientOnly.Value}");
				Debug.Log((object)$"SSAOdownSampling: {settings.downsampling} to {Main.SSAOdownSampling.Value}");
				Debug.Log((object)$"SSAOfarDistance: {settings.farDistance} to {Main.SSAOfarDistance.Value}");
				Debug.Log((object)$"SSAOsampleCount: {settings.sampleCount} to {(object)(SampleCount)Main.SSAOsampleCount.Value}");
			}
			settings.intensity = Main.SSAOintensity.Value;
			settings.highPrecision = Main.SSAOhighPrecision.Value;
			settings.ambientOnly = Main.SSAOambientOnly.Value;
			settings.downsampling = Main.SSAOdownSampling.Value;
			settings.farDistance = Main.SSAOfarDistance.Value;
			settings.sampleCount = (SampleCount)Main.SSAOsampleCount.Value;
			postProcessingBehaviour.profile.ambientOcclusion.settings = settings;
		}
	}

	[HarmonyPatch(typeof(CameraEffects), "SetMotionBlur", new Type[] { typeof(bool) })]
	[HarmonyPostfix]
	private static void SetMotionBlur()
	{
		//IL_0040: 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)
		//IL_011c: 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_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)postProcessingBehaviour == (Object)null) && !((Object)(object)postProcessingBehaviour.profile == (Object)null) && postProcessingBehaviour.profile.motionBlur != null)
		{
			Settings settings = postProcessingBehaviour.profile.motionBlur.settings;
			if (Main.printValues.Value)
			{
				Debug.Log((object)"[GraphicsConfigPlus] ----MotionBlur settings----");
				Debug.Log((object)$"FrameBlending: {settings.frameBlending} to {Main.MBframeBlending.Value}");
				Debug.Log((object)$"SampleCount: {settings.sampleCount} to {Main.MBsampleCount.Value}");
				Debug.Log((object)$"ShutterAngle: {settings.shutterAngle} to {Main.MBshutterAngle.Value}");
			}
			settings.frameBlending = Main.MBframeBlending.Value;
			settings.sampleCount = Main.MBsampleCount.Value;
			settings.shutterAngle = Main.MBshutterAngle.Value;
			postProcessingBehaviour.profile.motionBlur.settings = settings;
		}
	}

	[HarmonyPatch(typeof(CameraEffects), "SetAntiAliasing", new Type[] { typeof(bool) })]
	[HarmonyPostfix]
	private static void SetAntiAliasing()
	{
		//IL_0040: 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)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)postProcessingBehaviour == (Object)null) && !((Object)(object)postProcessingBehaviour.profile == (Object)null) && postProcessingBehaviour.profile.antialiasing != null)
		{
			Settings settings = postProcessingBehaviour.profile.antialiasing.settings;
			if (Main.printValues.Value)
			{
				Debug.Log((object)"[GraphicsConfigPlus] ----AntiAliasing settings----");
				Debug.Log((object)$"Method: {settings.method} to {(object)(Method)Main.AAmethod.Value}");
			}
			settings.method = (Method)Main.AAmethod.Value;
			postProcessingBehaviour.profile.antialiasing.settings = settings;
		}
	}

	[HarmonyPatch(typeof(CameraEffects), "SetCA", new Type[] { typeof(bool) })]
	[HarmonyPostfix]
	private static void SetCA()
	{
		//IL_0040: 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)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)postProcessingBehaviour == (Object)null) && !((Object)(object)postProcessingBehaviour.profile == (Object)null) && postProcessingBehaviour.profile.chromaticAberration != null)
		{
			Settings settings = postProcessingBehaviour.profile.chromaticAberration.settings;
			if (Main.printValues.Value)
			{
				Debug.Log((object)"[GraphicsConfigPlus] ----ChromaticAberration settings----");
				Debug.Log((object)$"Intensity: {settings.intensity} to {Main.CAintensity.Value}");
			}
			settings.intensity = Main.CAintensity.Value;
			postProcessingBehaviour.profile.chromaticAberration.settings = settings;
		}
	}
}