Decompiled source of PerformanceSettings v0.4.3

BepInEx/plugins/PerformanceSettings/Notest.PerformanceSettings.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using ContentSettings.API;
using ContentSettings.API.Settings;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PerformanceSettings.Settings;
using PerformanceSettings.Settings.Type;
using TMPro;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using UnityEngine.UI;
using Zorro.Core;
using Zorro.Settings;
using Zorro.Settings.DebugUI;
using Zorro.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Ashley.MeshSplitter")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("com.rlabrecque.steamworks.net")]
[assembly: IgnoresAccessChecksTo("Discord")]
[assembly: IgnoresAccessChecksTo("HBAO.Demo.Universal.Runtime")]
[assembly: IgnoresAccessChecksTo("HBAO.Runtime")]
[assembly: IgnoresAccessChecksTo("HBAO.Universal.Runtime")]
[assembly: IgnoresAccessChecksTo("MeshSplit")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("pworld")]
[assembly: IgnoresAccessChecksTo("sc.posteffects.runtime")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.Unity.Addressables")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.UnityLocalization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Tayx.Graphy")]
[assembly: IgnoresAccessChecksTo("Unity.Addressables")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InternalAPIEngineBridge.013")]
[assembly: IgnoresAccessChecksTo("Unity.Localization")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.PlayableGraphVisualizer")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipeline.Universal.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Universal.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Universal.Shaders")]
[assembly: IgnoresAccessChecksTo("Unity.ResourceManager")]
[assembly: IgnoresAccessChecksTo("Unity.ScriptableBuildPipeline")]
[assembly: IgnoresAccessChecksTo("Unity.Splines")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("Zorro.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Zorro.PhotonUtility")]
[assembly: IgnoresAccessChecksTo("Zorro.Recorder")]
[assembly: IgnoresAccessChecksTo("Zorro.Settings.Runtime")]
[assembly: IgnoresAccessChecksTo("Zorro.UI.Runtime")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Notest.PerformanceSettings")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.4.3.0")]
[assembly: AssemblyInformationalVersion("0.4.3+10030039cc69e45731d53af40ec166d3277179f9")]
[assembly: AssemblyProduct("PerformanceSettings")]
[assembly: AssemblyTitle("Notest.PerformanceSettings")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.4.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace PerformanceSettings
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Notest.PerformanceSettings";

		public const string PLUGIN_NAME = "PerformanceSettings";

		public const string PLUGIN_VERSION = "0.4.3";
	}
}
namespace PerformanceSettings.Settings
{
	internal class AimKeybindSetting : KeyCodeSetting, ICustomSetting, IExposedSetting
	{
		public string GetDisplayName()
		{
			return "Aim";
		}

		public SettingCategory GetSettingCategory()
		{
			return (SettingCategory)2;
		}

		public override KeyCode GetDefaultKey()
		{
			return (KeyCode)324;
		}
	}
	public class AntiAliasingSetting : EnumSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			Camera[] array = (Camera[])(object)Resources.FindObjectsOfTypeAll(typeof(Camera));
			Camera[] array2 = array;
			foreach (Camera val in array2)
			{
				switch (((IntSetting)this).Value)
				{
				case 0:
					CameraExtensions.GetUniversalAdditionalCameraData(val).antialiasing = (AntialiasingMode)0;
					break;
				case 1:
					CameraExtensions.GetUniversalAdditionalCameraData(val).antialiasing = (AntialiasingMode)1;
					CameraExtensions.GetUniversalAdditionalCameraData(val).antialiasingQuality = (AntialiasingQuality)2;
					break;
				case 2:
					CameraExtensions.GetUniversalAdditionalCameraData(val).antialiasing = (AntialiasingMode)2;
					CameraExtensions.GetUniversalAdditionalCameraData(val).antialiasingQuality = (AntialiasingQuality)2;
					break;
				}
			}
		}

		public override int GetDefaultValue()
		{
			return 0;
		}

		public override List<string> GetChoices()
		{
			return new List<string> { "OFF", "FXAA", "SMAA" };
		}

		public SettingCategory GetSettingCategory()
		{
			return (SettingCategory)0;
		}

		public string GetDisplayName()
		{
			return "Anti Aliasing";
		}
	}
	public class CrouchingModeSetting : EnumSetting, ICustomSetting, IExposedSetting, IPatch
	{
		internal class Patch
		{
			[HarmonyPatch(typeof(PlayerController), "MovementStateChanges")]
			[HarmonyPrefix]
			private static void PatchCrouchingMode(PlayerController __instance)
			{
				Traverse val = Traverse.Create((object)__instance).Field("player");
				if (((IntSetting)SettingsLoader.GetSetting<CrouchingModeSetting>()).Value == 1 && val != null)
				{
					object value = val.GetValue();
					Player val2 = (Player)((value is Player) ? value : null);
					val2.data.isCrouching = val2.input.crouchIsPressed;
					val.SetValue((object)val2);
				}
			}
		}

		public override void ApplyValue()
		{
		}

		public override int GetDefaultValue()
		{
			return 0;
		}

		public override List<string> GetChoices()
		{
			return new List<string> { "Toggle", "Hold" };
		}

		public SettingCategory GetSettingCategory()
		{
			return (SettingCategory)2;
		}

		public string GetDisplayName()
		{
			return "Crouching Mode";
		}

		public void ApplyPatch(ref Harmony harmony)
		{
			harmony.PatchAll(typeof(Patch));
		}
	}
	public class FOVSetting : FloatSetting, ICustomSetting, IExposedSetting, IPatch
	{
		internal class Patch
		{
			[HarmonyPatch(typeof(MainCamera), "Awake")]
			[HarmonyPostfix]
			private static void PatchFOV()
			{
				FOVSetting.baseFOVTraverse = Traverse.Create((object)MainCamera.instance).Field<float>("baseFOV");
				Debug.Log((object)("traverse " + (object)FOVSetting.baseFOVTraverse));
				try
				{
					Traverse<float> baseFOVTraverse = FOVSetting.baseFOVTraverse;
					if (baseFOVTraverse != null)
					{
						_ = baseFOVTraverse.Value;
						if (true)
						{
							FOVSetting.baseFOVTraverse.Value = ((FloatSetting)SettingsLoader.GetSetting<FOVSetting>()).Value;
						}
					}
				}
				catch (Exception)
				{
				}
			}
		}

		private static Traverse<float> baseFOVTraverse;

		public SettingCategory GetSettingCategory()
		{
			return (SettingCategory)0;
		}

		public string GetDisplayName()
		{
			return "FOV (Field Of View)";
		}

		public override float GetDefaultValue()
		{
			return 70.08072f;
		}

		public override float2 GetMinMaxValue()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return new float2(60f, 100f);
		}

		public override void ApplyValue()
		{
			if (baseFOVTraverse != null)
			{
				baseFOVTraverse.Value = ((FloatSetting)this).Value;
			}
		}

		public void ApplyPatch(ref Harmony harmony)
		{
			harmony.PatchAll(typeof(Patch));
		}
	}
	public class FSRSharpnessSetting : FloatSetting, ICustomSetting, IExposedSetting
	{
		public SettingCategory GetSettingCategory()
		{
			return (SettingCategory)0;
		}

		public string GetDisplayName()
		{
			return "FSR Sharpness Amount";
		}

		public override float GetDefaultValue()
		{
			return 0.92f;
		}

		public override float2 GetMinMaxValue()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return new float2(0f, 1f);
		}

		public override void ApplyValue()
		{
			RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline;
			UniversalRenderPipelineAsset val = (UniversalRenderPipelineAsset)(object)((currentRenderPipeline is UniversalRenderPipelineAsset) ? currentRenderPipeline : null);
			val.fsrSharpness = ((FloatSetting)this).Value;
		}
	}
	public class FSRToggleSetting : EnumSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline;
			UniversalRenderPipelineAsset val = (UniversalRenderPipelineAsset)(object)((currentRenderPipeline is UniversalRenderPipelineAsset) ? currentRenderPipeline : null);
			switch (((IntSetting)this).Value)
			{
			case 0:
				val.upscalingFilter = (UpscalingFilterSelection)0;
				val.fsrOverrideSharpness = false;
				break;
			case 1:
				val.upscalingFilter = (UpscalingFilterSelection)3;
				val.fsrOverrideSharpness = true;
				break;
			}
		}

		public override int GetDefaultValue()
		{
			return 0;
		}

		public override List<string> GetChoices()
		{
			return new List<string> { "OFF", "ON" };
		}

		public SettingCategory GetSettingCategory()
		{
			return (SettingCategory)0;
		}

		public string GetDisplayName()
		{
			return "FSR 1.0 (FidelityFx Super Resolution)";
		}
	}
	public class HDRSetting : EnumSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline;
			UniversalRenderPipelineAsset val = (UniversalRenderPipelineAsset)(object)((currentRenderPipeline is UniversalRenderPipelineAsset) ? currentRenderPipeline : null);
			switch (((IntSetting)this).Value)
			{
			case 0:
				val.supportsHDR = false;
				break;
			case 1:
				val.supportsHDR = true;
				break;
			}
		}

		public override int GetDefaultValue()
		{
			return 1;
		}

		public override List<string> GetChoices()
		{
			return new List<string> { "OFF", "ON" };
		}

		public SettingCategory GetSettingCategory()
		{
			return (SettingCategory)0;
		}

		public string GetDisplayName()
		{
			return "High Dynamic Range (HDR)";
		}
	}
	public class KeybindPatch : IPatch
	{
		public void ApplyPatch(ref Harmony harmony)
		{
			harmony.PatchAll(typeof(KeybindPatch));
		}

		[HarmonyPatch(typeof(PlayerInput), "SampeInput")]
		[HarmonyPostfix]
		private static void UseItemPatch(PlayerInput __instance, PlayerData data)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_0024: 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_0032: 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 (!(data.inputOverideAmount > 0.99f))
			{
				if (data.cantUseItemFor <= 0f)
				{
					KeyCode val = (KeyCode)((IntSetting)SettingsLoader.GetSetting<UseItemKeybindSetting>()).Value;
					__instance.clickWasPressed = GlobalInputHandler.GetKeyDown(val);
					__instance.clickIsPressed = GlobalInputHandler.GetKey(val);
					__instance.clickWasReleased = GlobalInputHandler.GetKeyUp(val);
				}
				KeyCode val2 = (KeyCode)((IntSetting)SettingsLoader.GetSetting<AimKeybindSetting>()).Value;
				__instance.aimWasPressed = GlobalInputHandler.GetKeyDown(val2);
				__instance.aimIsPressed = GlobalInputHandler.GetKey(val2);
			}
		}
	}
	internal class MasterVolumePatch : IPatch
	{
		[HarmonyPatch(typeof(MasterVolumeSetting), "GetMinMaxValue")]
		[HarmonyPostfix]
		private static void PatchMasterVolumeMinMax(ref float2 __result)
		{
			//IL_000b: 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)
			__result = new float2(0f, 2f);
		}

		public void ApplyPatch(ref Harmony harmony)
		{
			harmony.PatchAll(typeof(MasterVolumePatch));
		}
	}
	public class PostProcessingSetting : EnumSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			UniversalAdditionalCameraData[] array = (UniversalAdditionalCameraData[])(object)Resources.FindObjectsOfTypeAll(typeof(UniversalAdditionalCameraData));
			UniversalAdditionalCameraData[] array2 = array;
			foreach (UniversalAdditionalCameraData val in array2)
			{
				switch (((IntSetting)this).Value)
				{
				case 0:
					val.renderPostProcessing = false;
					break;
				case 1:
					val.renderPostProcessing = true;
					break;
				}
			}
		}

		public override int GetDefaultValue()
		{
			return 1;
		}

		public override List<string> GetChoices()
		{
			return new List<string> { "OFF", "ON" };
		}

		public SettingCategory GetSettingCategory()
		{
			return (SettingCategory)0;
		}

		public string GetDisplayName()
		{
			return "Post processing (off = Brightness won't work)";
		}
	}
	public class RenderScaleSetting : FloatSetting, ICustomSetting, IExposedSetting
	{
		public SettingCategory GetSettingCategory()
		{
			return (SettingCategory)0;
		}

		public string GetDisplayName()
		{
			return "Render Scale";
		}

		public override float GetDefaultValue()
		{
			return 1f;
		}

		public override float2 GetMinMaxValue()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return new float2(0.25f, 1f);
		}

		public override void ApplyValue()
		{
			RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline;
			UniversalRenderPipelineAsset val = (UniversalRenderPipelineAsset)(object)((currentRenderPipeline is UniversalRenderPipelineAsset) ? currentRenderPipeline : null);
			val.renderScale = ((FloatSetting)this).Value;
		}
	}
	internal class ResetAudioToDefault : StringSetting, ICustomSetting, IExposedSetting, IPatch
	{
		internal class Patch
		{
			[CompilerGenerated]
			private static class <>O
			{
				public static UnityAction <0>__OnButtonClicked;
			}

			[HarmonyPatch(typeof(KeyCodeSettingUI), "Setup")]
			[HarmonyPostfix]
			private static void ResetAudioToDefaultSettingUI(KeyCodeSettingUI __instance, Setting setting, ISettingHandler settingHandler)
			{
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Expected O, but got Unknown
				if (setting is ResetAudioToDefault)
				{
					((TMP_Text)__instance.label).text = "Reset";
					ButtonClickedEvent onClick = __instance.button.onClick;
					object obj = <>O.<0>__OnButtonClicked;
					if (obj == null)
					{
						UnityAction val = OnButtonClicked;
						<>O.<0>__OnButtonClicked = val;
						obj = (object)val;
					}
					((UnityEvent)onClick).AddListener((UnityAction)obj);
				}
			}

			[HarmonyPatch(typeof(SettingsCell), "Setup")]
			[HarmonyPostfix]
			private static void GetSettingCellTitle(SettingsCell __instance, Setting setting)
			{
				titleComponent = (TextMeshProUGUI)((setting is ResetAudioToDefault) ? ((object)__instance.title) : ((object)titleComponent));
			}

			[HarmonyPatch(typeof(MainMenuMainPage), "OnPageEnter")]
			[HarmonyPostfix]
			private static void PatchGetSettingHandler(MainMenuMainPage __instance)
			{
				pageHandler = ((UIPage)__instance).GetPageHandler<UIPageHandler>();
			}

			[HarmonyPatch(typeof(SettingCategoryTab), "Select")]
			[HarmonyPostfix]
			private static void PatchCategory(SettingCategoryTab __instance)
			{
				menu = __instance.settingsMenu;
			}
		}

		internal static TextMeshProUGUI titleComponent;

		internal static UIPageHandler pageHandler;

		internal static SettingsMenu menu;

		public SettingCategory GetSettingCategory()
		{
			return (SettingCategory)1;
		}

		public string GetDisplayName()
		{
			return "Reset Audio To Default";
		}

		public override void ApplyValue()
		{
		}

		protected override string GetDefaultValue()
		{
			return "";
		}

		internal static void OnButtonClicked()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			List<Setting> settings = GameHandler.Instance.SettingsHandler.GetSettings((SettingCategory)1);
			foreach (Setting item in settings)
			{
				ResolutionSetting val = (ResolutionSetting)(object)((item is ResolutionSetting) ? item : null);
				if (val != null)
				{
					Resolution val2 = val.GetResolutions().FirstOrDefault();
					Debug.Log((object)("Default Value " + ((Resolution)(ref val2)).width));
					val.SetValue(val2, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler);
					((Setting)val).Update();
				}
				IntSetting val3 = (IntSetting)(object)((item is IntSetting) ? item : null);
				if (val3 != null)
				{
					MethodInfo method = ((object)item).GetType().GetMethod("GetDefaultValue", BindingFlags.Instance | BindingFlags.NonPublic);
					object obj = method.Invoke(item, new object[0]);
					Debug.Log((object)("Default Value " + (int)obj));
					val3.SetValue((int)obj, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler);
					((Setting)val3).Update();
				}
				FloatSetting val4 = (FloatSetting)(object)((item is FloatSetting) ? item : null);
				if (val4 != null)
				{
					MethodInfo method2 = ((object)item).GetType().GetMethod("GetDefaultValue", BindingFlags.Instance | BindingFlags.NonPublic);
					object obj2 = method2.Invoke(item, new object[0]);
					Debug.Log((object)("Default Value " + (float)obj2));
					val4.SetValue((float)obj2, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler);
					((Setting)val4).Update();
				}
			}
			GameHandler.Instance.SettingsHandler.Update();
			GameHandler.Instance.SettingsHandler.RegisterPage();
			if ((Object)(object)pageHandler != (Object)null)
			{
				pageHandler.TransistionToPage<MainMenuMainPage>();
				pageHandler.TransistionToPage<MainMenuSettingsPage>();
				menu.SelectCategory((SettingCategory)1);
			}
		}

		public void ApplyPatch(ref Harmony harmony)
		{
			harmony.PatchAll(typeof(Patch));
		}
	}
	internal class ResetControlsToDefault : StringSetting, ICustomSetting, IExposedSetting, IPatch
	{
		internal class Patch
		{
			[CompilerGenerated]
			private static class <>O
			{
				public static UnityAction <0>__OnButtonClicked;
			}

			[HarmonyPatch(typeof(KeyCodeSettingUI), "Setup")]
			[HarmonyPostfix]
			private static void ResetAudioToDefaultSettingUI(KeyCodeSettingUI __instance, Setting setting, ISettingHandler settingHandler)
			{
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Expected O, but got Unknown
				if (setting is ResetControlsToDefault)
				{
					((TMP_Text)__instance.label).text = "Reset";
					ButtonClickedEvent onClick = __instance.button.onClick;
					object obj = <>O.<0>__OnButtonClicked;
					if (obj == null)
					{
						UnityAction val = OnButtonClicked;
						<>O.<0>__OnButtonClicked = val;
						obj = (object)val;
					}
					((UnityEvent)onClick).AddListener((UnityAction)obj);
				}
			}

			[HarmonyPatch(typeof(SettingsCell), "Setup")]
			[HarmonyPostfix]
			private static void GetSettingCellTitle(SettingsCell __instance, Setting setting)
			{
				titleComponent = (TextMeshProUGUI)((setting is ResetControlsToDefault) ? ((object)__instance.title) : ((object)titleComponent));
			}

			[HarmonyPatch(typeof(MainMenuMainPage), "OnPageEnter")]
			[HarmonyPostfix]
			private static void PatchGetSettingHandler(MainMenuMainPage __instance)
			{
				pageHandler = ((UIPage)__instance).GetPageHandler<UIPageHandler>();
			}

			[HarmonyPatch(typeof(SettingCategoryTab), "Select")]
			[HarmonyPostfix]
			private static void PatchCategory(SettingCategoryTab __instance)
			{
				menu = __instance.settingsMenu;
			}
		}

		internal static TextMeshProUGUI titleComponent;

		internal static UIPageHandler pageHandler;

		internal static SettingsMenu menu;

		public string GetDisplayName()
		{
			return "Reset Controls To Default";
		}

		public override void ApplyValue()
		{
		}

		protected override string GetDefaultValue()
		{
			return "";
		}

		internal static void OnButtonClicked()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			List<Setting> settings = GameHandler.Instance.SettingsHandler.GetSettings((SettingCategory)2);
			foreach (Setting item in settings)
			{
				ResolutionSetting val = (ResolutionSetting)(object)((item is ResolutionSetting) ? item : null);
				if (val != null)
				{
					Resolution val2 = val.GetResolutions().FirstOrDefault();
					Debug.Log((object)("Default Value " + ((Resolution)(ref val2)).width));
					val.SetValue(val2, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler);
					((Setting)val).Update();
				}
				IntSetting val3 = (IntSetting)(object)((item is IntSetting) ? item : null);
				if (val3 != null)
				{
					MethodInfo method = ((object)item).GetType().GetMethod("GetDefaultValue", BindingFlags.Instance | BindingFlags.NonPublic);
					object obj = method.Invoke(item, new object[0]);
					Debug.Log((object)("Default Value " + (int)obj));
					val3.SetValue((int)obj, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler);
					((Setting)val3).Update();
				}
				FloatSetting val4 = (FloatSetting)(object)((item is FloatSetting) ? item : null);
				if (val4 != null)
				{
					MethodInfo method2 = ((object)item).GetType().GetMethod("GetDefaultValue", BindingFlags.Instance | BindingFlags.NonPublic);
					object obj2 = method2.Invoke(item, new object[0]);
					Debug.Log((object)("Default Value " + (float)obj2));
					val4.SetValue((float)obj2, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler);
					((Setting)val4).Update();
				}
			}
			GameHandler.Instance.SettingsHandler.Update();
			GameHandler.Instance.SettingsHandler.RegisterPage();
			if ((Object)(object)pageHandler != (Object)null)
			{
				pageHandler.TransistionToPage<MainMenuMainPage>();
				pageHandler.TransistionToPage<MainMenuSettingsPage>();
				menu.SelectCategory((SettingCategory)2);
			}
		}

		public void ApplyPatch(ref Harmony harmony)
		{
			harmony.PatchAll(typeof(Patch));
		}
	}
	internal class ResetGraphicsToDefault : StringSetting, ICustomSetting, IExposedSetting, IPatch
	{
		internal class Patch
		{
			[CompilerGenerated]
			private static class <>O
			{
				public static UnityAction <0>__OnButtonClicked;
			}

			[HarmonyPatch(typeof(KeyCodeSettingUI), "Setup")]
			[HarmonyPostfix]
			private static void ResetGraphicsToDefaultSettingUI(KeyCodeSettingUI __instance, Setting setting, ISettingHandler settingHandler)
			{
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Expected O, but got Unknown
				if (setting is ResetGraphicsToDefault)
				{
					((TMP_Text)__instance.label).text = "Reset";
					ButtonClickedEvent onClick = __instance.button.onClick;
					object obj = <>O.<0>__OnButtonClicked;
					if (obj == null)
					{
						UnityAction val = OnButtonClicked;
						<>O.<0>__OnButtonClicked = val;
						obj = (object)val;
					}
					((UnityEvent)onClick).AddListener((UnityAction)obj);
				}
			}

			[HarmonyPatch(typeof(SettingsCell), "Setup")]
			[HarmonyPostfix]
			private static void GetSettingCellTitle(SettingsCell __instance, Setting setting)
			{
				titleComponent = (TextMeshProUGUI)((setting is ResetGraphicsToDefault) ? ((object)__instance.title) : ((object)titleComponent));
			}

			[HarmonyPatch(typeof(MainMenuMainPage), "OnPageEnter")]
			[HarmonyPostfix]
			private static void PatchGetSettingHandler(MainMenuMainPage __instance)
			{
				pageHandler = ((UIPage)__instance).GetPageHandler<UIPageHandler>();
			}
		}

		internal static TextMeshProUGUI titleComponent;

		internal static UIPageHandler pageHandler;

		public SettingCategory GetSettingCategory()
		{
			return (SettingCategory)0;
		}

		public string GetDisplayName()
		{
			return "Reset Graphics To Default";
		}

		public override void ApplyValue()
		{
		}

		protected override string GetDefaultValue()
		{
			return "";
		}

		internal static void OnButtonClicked()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			List<Setting> settings = GameHandler.Instance.SettingsHandler.GetSettings((SettingCategory)0);
			foreach (Setting item in settings)
			{
				ResolutionSetting val = (ResolutionSetting)(object)((item is ResolutionSetting) ? item : null);
				if (val != null)
				{
					Resolution val2 = val.GetResolutions().FirstOrDefault();
					Debug.Log((object)("Default Value " + ((Resolution)(ref val2)).width));
					val.SetValue(val2, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler);
					((Setting)val).Update();
				}
				IntSetting val3 = (IntSetting)(object)((item is IntSetting) ? item : null);
				if (val3 != null)
				{
					MethodInfo method = ((object)item).GetType().GetMethod("GetDefaultValue", BindingFlags.Instance | BindingFlags.NonPublic);
					object obj = method.Invoke(item, new object[0]);
					Debug.Log((object)("Default Value " + (int)obj));
					val3.SetValue((int)obj, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler);
					((Setting)val3).Update();
				}
				FloatSetting val4 = (FloatSetting)(object)((item is FloatSetting) ? item : null);
				if (val4 != null)
				{
					MethodInfo method2 = ((object)item).GetType().GetMethod("GetDefaultValue", BindingFlags.Instance | BindingFlags.NonPublic);
					object obj2 = method2.Invoke(item, new object[0]);
					Debug.Log((object)("Default Value " + (float)obj2));
					val4.SetValue((float)obj2, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler);
					((Setting)val4).Update();
				}
			}
			GameHandler.Instance.SettingsHandler.Update();
			GameHandler.Instance.SettingsHandler.RegisterPage();
			if ((Object)(object)pageHandler != (Object)null)
			{
				pageHandler.TransistionToPage<MainMenuMainPage>();
				pageHandler.TransistionToPage<MainMenuSettingsPage>();
			}
		}

		public void ApplyPatch(ref Harmony harmony)
		{
			harmony.PatchAll(typeof(Patch));
		}
	}
	internal class ResetPerformanceToDefault : StringSetting, ICustomSetting, IExposedSetting, IPatch
	{
		internal class Patch
		{
			[CompilerGenerated]
			private static class <>O
			{
				public static UnityAction <0>__OnButtonClicked;
			}

			[HarmonyPatch(typeof(KeyCodeSettingUI), "Setup")]
			[HarmonyPostfix]
			private static void ResetGraphicsToDefaultSettingUI(KeyCodeSettingUI __instance, Setting setting, ISettingHandler settingHandler)
			{
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Expected O, but got Unknown
				if (setting is ResetPerformanceToDefault)
				{
					((TMP_Text)__instance.label).text = "Reset";
					ButtonClickedEvent onClick = __instance.button.onClick;
					object obj = <>O.<0>__OnButtonClicked;
					if (obj == null)
					{
						UnityAction val = OnButtonClicked;
						<>O.<0>__OnButtonClicked = val;
						obj = (object)val;
					}
					((UnityEvent)onClick).AddListener((UnityAction)obj);
				}
			}

			[HarmonyPatch(typeof(SettingsCell), "Setup")]
			[HarmonyPostfix]
			private static void GetSettingCellTitle(SettingsCell __instance, Setting setting)
			{
				titleComponent = (TextMeshProUGUI)((setting is ResetPerformanceToDefault) ? ((object)__instance.title) : ((object)titleComponent));
			}
		}

		internal static TextMeshProUGUI titleComponent;

		public string GetDisplayName()
		{
			return "Reset Performance Tab To Default";
		}

		public override void ApplyValue()
		{
		}

		protected override string GetDefaultValue()
		{
			return "";
		}

		internal static void OnButtonClicked()
		{
			//IL_0066: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<string, List<Setting>> dictionary = default(Dictionary<string, List<Setting>>);
			SettingsLoader.TryGetTab("PERFORMANCE", ref dictionary);
			foreach (KeyValuePair<string, List<Setting>> item in dictionary)
			{
				foreach (Setting item2 in item.Value)
				{
					Debug.Log((object)("!!!!!!!!!!!!!!!! " + ((object)item2).ToString()));
					ResolutionSetting val = (ResolutionSetting)(object)((item2 is ResolutionSetting) ? item2 : null);
					if (val != null)
					{
						Resolution val2 = val.GetResolutions().FirstOrDefault();
						Debug.Log((object)("Default Value " + ((Resolution)(ref val2)).width));
						val.SetValue(val2, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler);
						((Setting)val).Update();
					}
					EnumSetting val3 = (EnumSetting)(object)((item2 is EnumSetting) ? item2 : null);
					if (val3 != null)
					{
						MethodInfo method = ((object)item2).GetType().GetMethod("GetDefaultValue", BindingFlags.Instance | BindingFlags.Public);
						object obj = method.Invoke(item2, new object[0]);
						Debug.Log((object)("Default Value " + (int)obj));
						((IntSetting)val3).SetValue((int)obj, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler);
						((Setting)val3).Update();
						continue;
					}
					IntSetting val4 = (IntSetting)(object)((item2 is IntSetting) ? item2 : null);
					if (val4 != null)
					{
						MethodInfo method2 = ((object)item2).GetType().GetMethod("GetDefaultValue", BindingFlags.Instance | BindingFlags.NonPublic);
						object obj2 = method2.Invoke(item2, new object[0]);
						Debug.Log((object)("Default Value " + (int)obj2));
						val4.SetValue((int)obj2, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler);
						((Setting)val4).Update();
					}
					FloatSetting val5 = (FloatSetting)(object)((item2 is FloatSetting) ? item2 : null);
					if (val5 != null)
					{
						MethodInfo method3 = ((object)item2).GetType().GetMethod("GetDefaultValue", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
						object obj3 = method3.Invoke(item2, new object[0]);
						Debug.Log((object)("Default Value " + (float)obj3));
						val5.SetValue((float)obj3, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler);
						((Setting)val5).Update();
					}
				}
			}
		}

		public void ApplyPatch(ref Harmony harmony)
		{
			harmony.PatchAll(typeof(Patch));
		}
	}
	internal class SFXVolumePatch : IPatch
	{
		[HarmonyPatch(typeof(SFXVolumeSetting), "GetMinMaxValue")]
		[HarmonyPostfix]
		private static void PatchSFXVolumeMinMax(ref float2 __result)
		{
			//IL_000b: 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)
			__result = new float2(0f, 2f);
		}

		public void ApplyPatch(ref Harmony harmony)
		{
			harmony.PatchAll(typeof(SFXVolumePatch));
		}
	}
	internal class ShadowQualityPatch : IPatch
	{
		public static class ShadowChanger
		{
			private static FieldInfo MainLightCastShadows_FieldInfo;

			private static FieldInfo AdditionalLightCastShadows_FieldInfo;

			private static FieldInfo MainLightShadowmapResolution_FieldInfo;

			private static FieldInfo AdditionalLightShadowmapResolution_FieldInfo;

			private static FieldInfo Cascade2Split_FieldInfo;

			private static FieldInfo Cascade4Split_FieldInfo;

			private static FieldInfo SoftShadowsEnabled_FieldInfo;

			public static bool MainLightCastShadows
			{
				get
				{
					return (bool)MainLightCastShadows_FieldInfo.GetValue(GraphicsSettings.currentRenderPipeline);
				}
				set
				{
					MainLightCastShadows_FieldInfo.SetValue(GraphicsSettings.currentRenderPipeline, value);
				}
			}

			public static bool AdditionalLightCastShadows
			{
				get
				{
					return (bool)AdditionalLightCastShadows_FieldInfo.GetValue(GraphicsSettings.currentRenderPipeline);
				}
				set
				{
					AdditionalLightCastShadows_FieldInfo.SetValue(GraphicsSettings.currentRenderPipeline, value);
				}
			}

			public static ShadowResolution MainLightShadowResolution
			{
				get
				{
					//IL_000f: Unknown result type (might be due to invalid IL or missing references)
					return (ShadowResolution)MainLightShadowmapResolution_FieldInfo.GetValue(GraphicsSettings.currentRenderPipeline);
				}
				set
				{
					//IL_000a: Unknown result type (might be due to invalid IL or missing references)
					MainLightShadowmapResolution_FieldInfo.SetValue(GraphicsSettings.currentRenderPipeline, value);
				}
			}

			public static ShadowResolution AdditionalLightShadowResolution
			{
				get
				{
					//IL_000f: Unknown result type (might be due to invalid IL or missing references)
					return (ShadowResolution)AdditionalLightShadowmapResolution_FieldInfo.GetValue(GraphicsSettings.currentRenderPipeline);
				}
				set
				{
					//IL_000a: Unknown result type (might be due to invalid IL or missing references)
					AdditionalLightShadowmapResolution_FieldInfo.SetValue(GraphicsSettings.currentRenderPipeline, value);
				}
			}

			public static float Cascade2Split
			{
				get
				{
					return (float)Cascade2Split_FieldInfo.GetValue(GraphicsSettings.currentRenderPipeline);
				}
				set
				{
					Cascade2Split_FieldInfo.SetValue(GraphicsSettings.currentRenderPipeline, value);
				}
			}

			public static Vector3 Cascade4Split
			{
				get
				{
					//IL_000f: Unknown result type (might be due to invalid IL or missing references)
					return (Vector3)Cascade4Split_FieldInfo.GetValue(GraphicsSettings.currentRenderPipeline);
				}
				set
				{
					//IL_000a: Unknown result type (might be due to invalid IL or missing references)
					Cascade4Split_FieldInfo.SetValue(GraphicsSettings.currentRenderPipeline, value);
				}
			}

			public static bool SoftShadowsEnabled
			{
				get
				{
					return (bool)SoftShadowsEnabled_FieldInfo.GetValue(GraphicsSettings.currentRenderPipeline);
				}
				set
				{
					SoftShadowsEnabled_FieldInfo.SetValue(GraphicsSettings.currentRenderPipeline, value);
				}
			}

			static ShadowChanger()
			{
				System.Type typeFromHandle = typeof(UniversalRenderPipelineAsset);
				BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic;
				MainLightCastShadows_FieldInfo = typeFromHandle.GetField("m_MainLightShadowsSupported", bindingAttr);
				AdditionalLightCastShadows_FieldInfo = typeFromHandle.GetField("m_AdditionalLightShadowsSupported", bindingAttr);
				MainLightShadowmapResolution_FieldInfo = typeFromHandle.GetField("m_MainLightShadowmapResolution", bindingAttr);
				AdditionalLightShadowmapResolution_FieldInfo = typeFromHandle.GetField("m_AdditionalLightsShadowmapResolution", bindingAttr);
				Cascade2Split_FieldInfo = typeFromHandle.GetField("m_Cascade2Split", bindingAttr);
				Cascade4Split_FieldInfo = typeFromHandle.GetField("m_Cascade4Split", bindingAttr);
				SoftShadowsEnabled_FieldInfo = typeFromHandle.GetField("m_SoftShadowsSupported", bindingAttr);
			}
		}

		[HarmonyPatch(typeof(ShadowQualitySetting), "SetShadowSettings")]
		[HarmonyPrefix]
		private static void PatchShadowQualityApply(ShadowQualitySetting __instance, ref ShadowResolution shadowResolution, ref float shadowDistance)
		{
			if (((IntSetting)__instance).Value == 2)
			{
				shadowResolution = (ShadowResolution)256;
				shadowDistance = 30f;
			}
			else if (((IntSetting)__instance).Value == 3)
			{
				shadowResolution = (ShadowResolution)0;
				shadowDistance = 0f;
			}
		}

		[HarmonyPatch(typeof(ShadowQualitySetting), "SetShadowSettings")]
		[HarmonyPostfix]
		private static void postPatchShadow(ShadowQualitySetting __instance, ref ShadowResolution shadowResolution, ref float shadowDistance)
		{
			RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline;
			UniversalRenderPipelineAsset val = (UniversalRenderPipelineAsset)(object)((currentRenderPipeline is UniversalRenderPipelineAsset) ? currentRenderPipeline : null);
			ShadowChanger.AdditionalLightShadowResolution = shadowResolution;
			ShadowChanger.MainLightShadowResolution = shadowResolution;
			Debug.Log((object)("Shadow Resolution " + val.mainLightShadowmapResolution + " [MoreSettings]"));
		}

		[HarmonyPatch(typeof(ShadowQualitySetting), "GetChoices")]
		[HarmonyPostfix]
		private static void PatchShadowQualityChoices(ref List<string> __result)
		{
			__result = new List<string> { "High", "Low", "Lowest", "Off" };
		}

		public void ApplyPatch(ref Harmony harmony)
		{
			harmony.PatchAll(typeof(ShadowQualityPatch));
		}
	}
	public class TextureResolutionSetting : EnumSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			QualitySettings.globalTextureMipmapLimit = 3 - ((IntSetting)this).Value;
		}

		public override int GetDefaultValue()
		{
			return 3;
		}

		public override List<string> GetChoices()
		{
			return new List<string> { "Low", "Medium", "High", "Very High" };
		}

		public SettingCategory GetSettingCategory()
		{
			return (SettingCategory)0;
		}

		public string GetDisplayName()
		{
			return "Texture Resolution";
		}
	}
	internal class UseItemKeybindSetting : KeyCodeSetting, ICustomSetting, IExposedSetting, IPatch
	{
		public void ApplyPatch(ref Harmony harmony)
		{
			harmony.PatchAll(typeof(Patch));
		}

		public string GetDisplayName()
		{
			return "Use Item";
		}

		public SettingCategory GetSettingCategory()
		{
			return (SettingCategory)2;
		}

		public override KeyCode GetDefaultKey()
		{
			return (KeyCode)323;
		}
	}
	internal class VoiceVolumePatch : IPatch
	{
		[HarmonyPatch(typeof(VoiceVolumeSetting), "GetMinMaxValue")]
		[HarmonyPostfix]
		private static void PatchVoiceVolumeMinMax(ref float2 __result)
		{
			//IL_000b: 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)
			__result = new float2(0f, 2f);
		}

		public void ApplyPatch(ref Harmony harmony)
		{
			harmony.PatchAll(typeof(VoiceVolumePatch));
		}
	}
}
namespace PerformanceSettings.Settings.Type
{
	public interface IPatch
	{
		void ApplyPatch(ref Harmony harmony);
	}
	public abstract class StringSetting : Setting
	{
		public string Value { get; protected set; }

		public override SettingUI GetDebugUI(ISettingHandler settingHandler)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			return new SettingUI();
		}

		public override void Load(ISettingsSaveLoad loader)
		{
			string value = default(string);
			if (loader.TryGetString(((object)this).GetType(), ref value))
			{
				Value = value;
				return;
			}
			Debug.LogWarning((object)("Failed to load setting of type " + ((object)this).GetType().FullName + " from PlayerPrefs."));
			Value = GetDefaultValue();
		}

		protected abstract string GetDefaultValue();

		public override GameObject GetSettingUICell()
		{
			return SingletonAsset<InputCellMapper>.Instance.KeyCodeSettingCell;
		}

		public override void Save(ISettingsSaveLoad saver)
		{
			saver.SaveString(((object)this).GetType(), Value);
		}

		public void SetValue(string value, ISettingHandler handler)
		{
			Value = value;
			((Setting)this).ApplyValue();
			handler.SaveSetting((Setting)(object)this);
		}
	}
}
namespace MoreSettings
{
	[ContentWarningPlugin("Notest.PerformanceSettings", "0.4.3", true)]
	[BepInPlugin("Notest.PerformanceSettings", "PerformanceSettings", "0.4.3")]
	public class PerformanceSettings : BaseUnityPlugin
	{
		private Harmony? harmony;

		internal static List<Setting> additionalSettings = new List<Setting>();

		internal static List<IPatch> patches = new List<IPatch>();

		public static PerformanceSettings Instance { get; private set; } = null;


		private void Awake()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			Instance = this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Notest.PerformanceSettings v0.4.3 has Loaded!!!!");
			addSetting((Setting)(object)new HDRSetting());
			addSetting((Setting)new RenderScaleSetting());
			addSetting((Setting)(object)new FSRToggleSetting());
			addSetting((Setting)(object)new FSRSharpnessSetting());
			addSetting((Setting)(object)new TextureResolutionSetting());
			addSetting((Setting)(object)new AntiAliasingSetting());
			addSetting((Setting)(object)new PostProcessingSetting());
			addSetting((Setting)(object)new FOVSetting());
			addSetting((Setting)(object)new ResetPerformanceToDefault());
			addSetting((Setting)(object)new CrouchingModeSetting(), "CONTROLS-QOL");
			addSetting((Setting)(object)new UseItemKeybindSetting(), "CONTROLS-QOL");
			addSetting((Setting)(object)new AimKeybindSetting(), "CONTROLS-QOL");
			addSetting((Setting)(object)new ResetControlsToDefault(), "CONTROLS-QOL");
			addSetting((Setting)(object)new ResetGraphicsToDefault(), "GRAPHICS-QOL");
			addSetting((Setting)(object)new ResetAudioToDefault(), "AUDIO-QOL");
			addPatches(new ShadowQualityPatch());
			addPatches(new VoiceVolumePatch());
			addPatches(new SFXVolumePatch());
			addPatches(new MasterVolumePatch());
			addPatches(new KeybindPatch());
			if (harmony == null)
			{
				harmony = new Harmony("Notest.PerformanceSettings");
			}
			ApplyPatches();
		}

		internal void ApplyPatches()
		{
			foreach (Setting additionalSetting in additionalSettings)
			{
				if (additionalSetting is IPatch)
				{
					IPatch patch = additionalSetting as IPatch;
					patch.ApplyPatch(ref harmony);
				}
			}
			foreach (IPatch patch2 in patches)
			{
				patch2.ApplyPatch(ref harmony);
			}
		}

		public static void addSetting(Setting setting, string tab = "PERFORMANCE", string? category = null)
		{
			SettingsLoader.RegisterSetting(tab, category, setting);
			additionalSettings.Add(setting);
		}

		internal static void addPatches(IPatch patch)
		{
			patches.Add(patch);
		}
	}
	public class Tools
	{
		public static void LogMessage(string message)
		{
			FileLog.Log(message);
			Debug.Log((object)message);
		}

		public static void ApplySettings()
		{
			foreach (Setting item in GameHandler.Instance.SettingsHandler.GetAllSettingsNonAlloc())
			{
				item.ApplyValue();
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}