Decompiled source of OldSchoolGraphics v0.1.1

OldSchoolGraphics.dll

Decompiled 11 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Agents;
using AssetShards;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using CellMenu;
using CullingSystem;
using Enemies;
using ExteriorRendering;
using GTFO.API;
using GTFO.API.Utilities;
using GameData;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using OldSchoolGraphics.Comps;
using OldSchoolGraphics.Configurations;
using OldSchoolGraphics.Controllers;
using OldSchoolGraphics.Controllers.ShaderInfos;
using OldSchoolGraphics.Utils;
using Player;
using SubsurfaceScattering;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;
using UnityStandardAssets.ImageEffects;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("OldSchoolGraphics")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+git5263776-dirty-master")]
[assembly: AssemblyProduct("OldSchoolGraphics")]
[assembly: AssemblyTitle("OldSchoolGraphics")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace OldSchoolGraphics
{
	internal static class CustomAssets
	{
		public static GameObject LegacyParticlePrefab { get; private set; }

		public static void Init()
		{
			LegacyParticlePrefab = AssetAPI.GetLoadedAsset<GameObject>("Assets/OSG/DustParticle.prefab");
		}
	}
	[BepInPlugin("OldSchoolGraphics.GUID", "OldSchoolGraphics", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class EntryPoint : BasePlugin
	{
		private Harmony _Harmony;

		public override void Load()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			CFG.Initialize("OldSchoolGraphics.cfg");
			ClassInjector.RegisterTypeInIl2Cpp<ScreenGrains>();
			ClassInjector.RegisterTypeInIl2Cpp<FogPrelit>();
			ClassInjector.RegisterTypeInIl2Cpp<ScreenBlackAndWhite>();
			ClassInjector.RegisterTypeInIl2Cpp<DebugBehaviour>();
			_Harmony = new Harmony("OldSchoolGraphics.Harmony");
			_Harmony.PatchAll();
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin has loaded with ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_Harmony.GetPatchedMethods().Count());
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" patches!");
			}
			Logger.Info(val);
			AssetAPI.OnStartupAssetsLoaded += AssetAPI_OnStartupAssetsLoaded;
		}

		private void AssetAPI_OnStartupAssetsLoaded()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			AssetBundleShard[] values = Enum.GetValues<AssetBundleShard>();
			foreach (AssetBundleShard val in values)
			{
				AssetShardManager.LoadShard(AssetShardManager.GetShardName((AssetBundleName)140, val), (LoadSceneMode)1);
				AssetShardManager.LoadShard(AssetShardManager.GetShardName((AssetBundleName)150, val), (LoadSceneMode)1);
				AssetShardManager.LoadShard(AssetShardManager.GetShardName((AssetBundleName)160, val), (LoadSceneMode)1);
				AssetShardManager.LoadShard(AssetShardManager.GetShardName((AssetBundleName)170, val), (LoadSceneMode)1);
			}
			EmissionUpdater.Init();
			LocalPlayer.Init();
			CustomAssets.Init();
		}

		public override bool Unload()
		{
			_Harmony.UnpatchSelf();
			return ((BasePlugin)this).Unload();
		}
	}
	internal static class Logger
	{
		private static readonly ManualLogSource _Logger;

		static Logger()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			_Logger = new ManualLogSource("OldSchoolGraphics");
			Logger.Sources.Add((ILogSource)(object)_Logger);
		}

		private static string Format(object msg)
		{
			return msg.ToString();
		}

		public static void Info(BepInExInfoLogInterpolatedStringHandler handler)
		{
			_Logger.LogInfo(handler);
		}

		public static void Info(string str)
		{
			_Logger.LogMessage((object)str);
		}

		public static void Info(object data)
		{
			_Logger.LogMessage((object)Format(data));
		}

		public static void Debug(BepInExDebugLogInterpolatedStringHandler handler)
		{
			_Logger.LogDebug(handler);
		}

		public static void Debug(string str)
		{
			_Logger.LogDebug((object)str);
		}

		public static void Debug(object data)
		{
			_Logger.LogDebug((object)Format(data));
		}

		public static void Error(BepInExErrorLogInterpolatedStringHandler handler)
		{
			_Logger.LogError(handler);
		}

		public static void Error(string str)
		{
			_Logger.LogError((object)str);
		}

		public static void Error(object data)
		{
			_Logger.LogError((object)Format(data));
		}

		public static void Fatal(BepInExFatalLogInterpolatedStringHandler handler)
		{
			_Logger.LogFatal(handler);
		}

		public static void Fatal(string str)
		{
			_Logger.LogFatal((object)str);
		}

		public static void Fatal(object data)
		{
			_Logger.LogFatal((object)Format(data));
		}

		public static void Warn(BepInExWarningLogInterpolatedStringHandler handler)
		{
			_Logger.LogWarning(handler);
		}

		public static void Warn(string str)
		{
			_Logger.LogWarning((object)str);
		}

		public static void Warn(object data)
		{
			_Logger.LogWarning((object)Format(data));
		}

		[Conditional("DEBUG")]
		public static void DebugOnly(object data)
		{
		}
	}
	[GeneratedCode("VersionInfoGenerator", "2.0.0+git50a4b1a-master")]
	[CompilerGenerated]
	internal static class VersionInfo
	{
		public const string RootNamespace = "OldSchoolGraphics";

		public const string Version = "1.0.0";

		public const string VersionPrerelease = null;

		public const string VersionMetadata = "git5263776-dirty-master";

		public const string SemVer = "1.0.0+git5263776-dirty-master";

		public const string GitRevShort = "5263776-dirty";

		public const string GitRevLong = "5263776a5bdacb9ff8a9c8269e720fefd7ed559e-dirty";

		public const string GitBranch = "master";

		public const string GitTag = null;

		public const bool GitIsDirty = true;
	}
}
namespace OldSchoolGraphics.Utils
{
	internal static class ComponentExtension
	{
		public static T GetOrAddComponent<T>(this Component self) where T : Component
		{
			T component = self.gameObject.GetComponent<T>();
			if ((Object)(object)component != (Object)null)
			{
				return component;
			}
			return self.gameObject.AddComponent<T>();
		}

		public static bool TryGetOrAddComponent<T>(this Component self, out T comp) where T : Component
		{
			comp = self.GetOrAddComponent<T>();
			return (Object)(object)comp != (Object)null;
		}
	}
	internal static class LocalPlayer
	{
		private static PlayerAgent _LocalPlayerAgent;

		private static FPSCamera _FPSCam;

		public static int FPSSpotInstanceID { get; private set; } = -1;


		internal static void Init()
		{
			CoroutineDispatcher.StartCoroutine(Update());
		}

		private static IEnumerator Update()
		{
			while (true)
			{
				_LocalPlayerAgent = PlayerManager.GetLocalPlayerAgent();
				_FPSCam = (((Object)(object)_LocalPlayerAgent != (Object)null) ? _LocalPlayerAgent.FPSCamera : null);
				FPSSpotInstanceID = -1;
				if ((Object)(object)_LocalPlayerAgent != (Object)null && (Object)(object)_LocalPlayerAgent.Inventory != (Object)null && _LocalPlayerAgent.Inventory.m_flashlightCLight != null && (Object)(object)((C_Light)_LocalPlayerAgent.Inventory.m_flashlightCLight).m_unityLight != (Object)null)
				{
					FPSSpotInstanceID = ((Object)((C_Light)_LocalPlayerAgent.Inventory.m_flashlightCLight).m_unityLight).GetInstanceID();
				}
				yield return null;
			}
		}

		public static bool TryGet(out PlayerAgent localPlayer)
		{
			localPlayer = _LocalPlayerAgent;
			return (Object)(object)localPlayer != (Object)null;
		}

		public static bool TryGetFPSCam(out FPSCamera fpsCam)
		{
			fpsCam = _FPSCam;
			return (Object)(object)fpsCam != (Object)null;
		}
	}
}
namespace OldSchoolGraphics.Inject
{
	[HarmonyPatch(typeof(ExteriorCamera))]
	internal class Inject_ExteriorCamera
	{
		[HarmonyPostfix]
		[HarmonyPatch("SetEnabled")]
		private static void Post_OnEnable(ExteriorCamera __instance)
		{
			OldSchoolSettings.ApplyPPSettings(__instance.m_fpsCamera);
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetDisabled")]
		private static void Post_OnDisable(ExteriorCamera __instance)
		{
			OldSchoolSettings.ApplyPPSettings(__instance.m_fpsCamera);
		}
	}
	[HarmonyPatch(typeof(FPSCamera))]
	internal class Inject_FPSCamera
	{
		[HarmonyPrefix]
		[HarmonyPatch("Setup", new Type[] { typeof(LocalPlayerAgent) })]
		private static void Pre_Setup(FPSCamera __instance)
		{
			if (!__instance.m_isSetup)
			{
				OldSchoolSettings.AddGraphicComponents(__instance);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("RefreshPostEffectsEnabled")]
		private static void Post_Refresh(FPSCamera __instance)
		{
			OldSchoolSettings.ApplyPPSettings(__instance);
		}
	}
	[HarmonyPatch(typeof(PostMicroScratchLoader), "Start")]
	internal class Inject_MicroScratch
	{
		private static void Postfix()
		{
			Shader.SetGlobalTexture("_GlassMicroFacetsA", (Texture)(object)Texture2D.blackTexture);
		}
	}
	[HarmonyPatch(typeof(PlayerInventoryBase), "UpdateFPSFlashlightAlignment")]
	internal class Inject_PlayerFlashlight
	{
		private static void Postfix(PlayerInventoryBase __instance)
		{
			//IL_0083: 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)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)__instance.Owner == (Object)null) && ((Agent)__instance.Owner).IsLocallyOwned && !((Object)(object)__instance.Owner.Owner == (Object)null) && !__instance.Owner.Owner.IsBot && !((Object)(object)__instance.Owner.FPSCamera == (Object)null) && __instance.m_flashlightCLight != null)
			{
				Camera camera = ((CameraController)__instance.Owner.FPSCamera).m_camera;
				Light unityLight = ((C_Light)__instance.m_flashlightCLight).m_unityLight;
				Vector3 val = ((Component)camera).transform.position + ((Component)camera).transform.forward * 6f - ((Component)unityLight).transform.position;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				((Component)unityLight).transform.rotation = Quaternion.LookRotation(Vector3.Lerp(normalized, ((Component)unityLight).transform.forward, CFG.User.FlashlightSwayFactor));
			}
		}
	}
}
namespace OldSchoolGraphics.Inject.RenderPipelines
{
	[HarmonyPatch]
	internal class Inject_CL_Light
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(CL_SpotLight), "UpdateData")]
		private static void Post_UpdateSpot(CL_SpotLight __instance)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			if (((Object)((CL_Light)__instance).UnityLight).GetInstanceID() != LocalPlayer.FPSSpotInstanceID)
			{
				sCL_SpotLight data = __instance.Data;
				Vector3 lit = data.Irradiance;
				Light unityLight = ((CL_Light)__instance).UnityLight;
				Transform transform = ((Component)__instance).transform;
				RetoneColor(CFG.FogLit.SpotColorMaxCap, data.Position, ref lit, out var rangeBoost);
				data.Irradiance = lit * CFG.FogLit.SpotColorScale;
				float num = unityLight.range + rangeBoost;
				data.InvRangeSqr *= 1f / (num * num);
				Vector3 position = transform.position;
				Quaternion rotation = transform.rotation;
				Vector3 val = 2f * num * Vector3.one;
				((CL_Light)__instance).LightMatrix = Matrix4x4.TRS(position, rotation, val);
				__instance.Data = data;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CL_PointLight), "UpdateData")]
		private static void Post_UpdatePoint(CL_PointLight __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_0026: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			sCL_PointLight data = __instance.Data;
			Vector3 lit = data.Irradiance;
			Light unityLight = ((CL_Light)__instance).UnityLight;
			Transform transform = ((Component)__instance).transform;
			RetoneColor(CFG.FogLit.PointColorMaxCap, data.Position, ref lit, out var rangeBoost);
			data.Irradiance = lit * CFG.FogLit.PointColorScale;
			float num = unityLight.range + rangeBoost;
			data.InvRangeSqr *= 1f / (num * num);
			Vector3 position = transform.position;
			Quaternion rotation = transform.rotation;
			float num2 = num * Mathf.Tan(unityLight.spotAngle * 0.5f * (MathF.PI / 180f));
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(num2, num2, num);
			((CL_Light)__instance).LightMatrix = Matrix4x4.TRS(position, rotation, val);
			__instance.Data = data;
		}

		private static void RetoneColor(float maxCap, Vector3 pos, ref Vector3 lit, out float rangeBoost)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			float num = lit.x * 0.212f + lit.y * 0.701f + lit.z * 0.087f;
			float num2 = maxCap + GetDensityLitBonus(pos);
			float num3 = num - num2;
			if (num3 > 0f)
			{
				lit = lit / num * num2;
				rangeBoost = num3 * CFG.FogLit.LitAdjustment_IntensityToRangeWeight;
			}
			else
			{
				rangeBoost = 0f;
			}
		}

		private static float GetDensityLitBonus(Vector3 pos)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			PreLitVolume current = PreLitVolume.Current;
			if ((Object)(object)current == (Object)null)
			{
				return 0f;
			}
			float fogDensity = current.GetFogDensity(pos);
			return Mathf.InverseLerp(CFG.FogLit.LitAdjustment_MinDensity, CFG.FogLit.LitAdjustment_MaxDensity, fogDensity) * CFG.FogLit.LitAdjustment_DensityBonusAmount;
		}
	}
	[HarmonyPatch(typeof(PreLitVolume), "CollectCommands")]
	internal static class Inject_PreLitVolume_CollectCmd
	{
		private static ComputeBuffer _LightCluster__Back;

		private static ComputeBuffer _EmptyBuffer__Back;

		public static ComputeBuffer NewFogLightCluster
		{
			get
			{
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Expected O, but got Unknown
				if (_LightCluster__Back == null)
				{
					_LightCluster__Back = new ComputeBuffer(ClusteredRendering.Current.m_lightCluster.count, 80);
				}
				return _LightCluster__Back;
			}
		}

		private static ComputeBuffer EmptyBuffer
		{
			get
			{
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Expected O, but got Unknown
				if (_EmptyBuffer__Back == null)
				{
					_EmptyBuffer__Back = new ComputeBuffer(1, 80);
				}
				return _EmptyBuffer__Back;
			}
		}

		private static void Prefix(PreLitVolume __instance, CommandBuffer cmd)
		{
			FogPrelit.Current.UpdateClusteredEntry(ClusteredRendering.Current, cmd);
		}

		private static void Postfix(PreLitVolume __instance, CommandBuffer cmd)
		{
			FogPrelit.Current.RevertClusteredEntry(ClusteredRendering.Current, cmd);
		}
	}
}
namespace OldSchoolGraphics.Inject.MeleeParts
{
	[HarmonyPatch(typeof(GearPartSpawner), "AddPart")]
	internal class Inject_GearPartSpawner
	{
		private static void Prefix(ref GearPartGeneralData general)
		{
			switch (CFG.User.MeleeType)
			{
			case MeleeOverride.Gavel:
				HammerInfo.Default.ReplaceTo(HammerInfo.Gavel, ref general);
				break;
			case MeleeOverride.Maul:
				HammerInfo.Default.ReplaceTo(HammerInfo.Maul, ref general);
				break;
			case MeleeOverride.Sledgehammer:
				HammerInfo.Default.ReplaceTo(HammerInfo.Sledge, ref general);
				break;
			case MeleeOverride.Mallet:
				HammerInfo.Default.ReplaceTo(HammerInfo.Mallet, ref general);
				break;
			}
		}
	}
	internal class HammerInfo
	{
		public string HeadPrefab;

		public string NeckPrefab;

		public string HandlePrefab;

		public string PommelPrefab;

		private GearPartGeneralData _HeadData;

		private GearPartGeneralData _NeckData;

		private GearPartGeneralData _HandleData;

		private GearPartGeneralData _PommelData;

		public static HammerInfo Gavel = new HammerInfo
		{
			HeadPrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Heads/Head_Hammer_10.prefab",
			NeckPrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Necks/Neck_Hammer_5.prefab",
			HandlePrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Handles/Handle_Hammer_7.prefab",
			PommelPrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Pommels/Pommel_Hammer_10.prefab"
		};

		public static HammerInfo Maul = new HammerInfo
		{
			HeadPrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Heads/Head_Hammer_7.prefab",
			NeckPrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Necks/Neck_Hammer_8.prefab",
			HandlePrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Handles/Handle_Hammer_1.prefab",
			PommelPrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Pommels/Pommel_Hammer_5.prefab"
		};

		public static HammerInfo Sledge = new HammerInfo
		{
			HeadPrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Heads/Head_Hammer_1.prefab",
			NeckPrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Necks/Neck_Hammer_4.prefab",
			HandlePrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Handles/Handle_Hammer_8.prefab",
			PommelPrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Pommels/Pommel_Hammer_3.prefab"
		};

		public static HammerInfo Mallet = new HammerInfo
		{
			HeadPrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Heads/Head_Hammer_6.prefab",
			NeckPrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Necks/Neck_Hammer_7.prefab",
			HandlePrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Handles/Handle_Hammer_9.prefab",
			PommelPrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Pommels/Pommel_Hammer_9.prefab"
		};

		public static HammerInfo Default = new HammerInfo
		{
			HeadPrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Heads/Head_Hammer_5.prefab",
			NeckPrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Necks/Neck_Hammer_10.prefab",
			HandlePrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Handles/Handle_Hammer_6.prefab",
			PommelPrefab = "Assets/AssetPrefabs/Items/Gear/Parts/Melee/Pommels/Pommel_Hammer_10.prefab"
		};

		public GearPartGeneralData HeadData
		{
			get
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Expected O, but got Unknown
				//IL_003a: Expected O, but got Unknown
				if (_HeadData != null)
				{
					return _HeadData;
				}
				GearPartGeneralData val = new GearPartGeneralData
				{
					AssetBundle = (AssetBundleName)140,
					GearCategoryFilter = 0u,
					Model = HeadPrefab
				};
				GearPartGeneralData result = val;
				_HeadData = val;
				return result;
			}
		}

		public GearPartGeneralData NeckData
		{
			get
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Expected O, but got Unknown
				//IL_003a: Expected O, but got Unknown
				if (_NeckData != null)
				{
					return _NeckData;
				}
				GearPartGeneralData val = new GearPartGeneralData
				{
					AssetBundle = (AssetBundleName)150,
					GearCategoryFilter = 0u,
					Model = NeckPrefab
				};
				GearPartGeneralData result = val;
				_NeckData = val;
				return result;
			}
		}

		public GearPartGeneralData HandleData
		{
			get
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Expected O, but got Unknown
				//IL_003a: Expected O, but got Unknown
				if (_HandleData != null)
				{
					return _HandleData;
				}
				GearPartGeneralData val = new GearPartGeneralData
				{
					AssetBundle = (AssetBundleName)160,
					GearCategoryFilter = 0u,
					Model = HandlePrefab
				};
				GearPartGeneralData result = val;
				_HandleData = val;
				return result;
			}
		}

		public GearPartGeneralData PommelData
		{
			get
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Expected O, but got Unknown
				//IL_003a: Expected O, but got Unknown
				if (_PommelData != null)
				{
					return _PommelData;
				}
				GearPartGeneralData val = new GearPartGeneralData
				{
					AssetBundle = (AssetBundleName)170,
					GearCategoryFilter = 0u,
					Model = PommelPrefab
				};
				GearPartGeneralData result = val;
				_PommelData = val;
				return result;
			}
		}

		public void ReplaceTo(HammerInfo replaceTo, ref GearPartGeneralData general)
		{
			if (HeadPrefab.Equals(general.Model, StringComparison.InvariantCultureIgnoreCase))
			{
				general = replaceTo.HeadData;
			}
			else if (NeckPrefab.Equals(general.Model, StringComparison.InvariantCultureIgnoreCase))
			{
				general = replaceTo.NeckData;
			}
			else if (HandlePrefab.Equals(general.Model, StringComparison.InvariantCultureIgnoreCase))
			{
				general = replaceTo.HandleData;
			}
			else if (PommelPrefab.Equals(general.Model, StringComparison.InvariantCultureIgnoreCase))
			{
				general = replaceTo.PommelData;
			}
		}
	}
}
namespace OldSchoolGraphics.Inject.Lobby
{
	internal class Inject_LobbyLight
	{
		private static void Postfix(CM_PageLoadoutLighting __instance)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			((Behaviour)__instance.RimLight).enabled = false;
			((Behaviour)__instance.FillLight).enabled = false;
			((Behaviour)__instance.MainLight).enabled = true;
			__instance.MainLight.intensity = 1.7f;
			__instance.FillLight.intensity = 0.75f;
			__instance.MainLight.color = ColorExt.Hex("#3f3f3f");
			__instance.RimLight.intensity = 2f;
			__instance.HelmetLightIntensityScale = 0f;
			__instance.AmbientIntensity = 10f;
			__instance.ReflectionIntensity = 0f;
			__instance.SmoothnessLimiter = 0.1f;
			__instance.RayScale = 0.01f;
			__instance.Bias = 1f;
		}
	}
	[HarmonyPatch(typeof(CM_PlayerLobbyBar))]
	internal class Inject_PlayerLobbyBar
	{
		private static void Post_PlayerModelSpawned(CM_PlayerLobbyBar __instance)
		{
			ScreenBlackAndWhite.Instance.AddTrackingTransform(__instance.m_playerModelAlign);
			ScreenBlackAndWhite.Instance.UpdateCommand();
		}

		private static void Post_VanityItemChanged()
		{
			ScreenBlackAndWhite.Instance.UpdateCommand();
		}
	}
}
namespace OldSchoolGraphics.Inject.Emissions
{
	[HarmonyPatch(typeof(EnemyAppearance))]
	internal class Inject_EnemyGlow
	{
		[HarmonyPrefix]
		[HarmonyPatch("InterpolateGlow")]
		[HarmonyPatch(new Type[]
		{
			typeof(Color),
			typeof(Vector4),
			typeof(float)
		})]
		[HarmonyPriority(0)]
		private static void Pre_InterpolateGlow1(ref Color col)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			col *= 6.237f * CFG.Emission.EnemyGlowScale;
			float num = col.r * 0.212f + col.g * 0.701f + col.b * 0.087f;
			float enemyGlowCap = CFG.Emission.EnemyGlowCap;
			if (num > enemyGlowCap)
			{
				col = col / num * enemyGlowCap;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("InterpolateGlow")]
		[HarmonyPatch(new Type[]
		{
			typeof(Color),
			typeof(float)
		})]
		[HarmonyPriority(0)]
		private static void Pre_InterpolateGlow2(ref Color col)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			col *= 6.237f * CFG.Emission.EnemyGlowScale;
			float num = col.r * 0.212f + col.g * 0.701f + col.b * 0.087f;
			float enemyGlowCap = CFG.Emission.EnemyGlowCap;
			if (num > enemyGlowCap)
			{
				col = col / num * enemyGlowCap;
			}
		}
	}
	[HarmonyPatch(typeof(PlayerInventoryBase))]
	internal class Inject_Flashlight
	{
		[HarmonyPatch("PrepareHelmetFlashlight")]
		[HarmonyPostfix]
		private static void Post_HelmetLight(PlayerInventoryBase __instance)
		{
			Light flashlight = __instance.m_flashlight;
			flashlight.intensity *= CFG.Emission.FlashlightIntenisty * 1.5f;
		}

		[HarmonyPatch("OnItemEquippableFlashlightWielded")]
		[HarmonyPostfix]
		private static void Post_GearLight(PlayerInventoryBase __instance, GearPartFlashlight flashlight)
		{
			if (flashlight.m_settingsID != 0)
			{
				FlashlightSettingsDataBlock block = GameDataBlockBase<FlashlightSettingsDataBlock>.GetBlock(flashlight.m_settingsID);
				__instance.m_flashlight.intensity = block.intensity * CFG.Emission.FlashlightIntenisty * 1.5f;
			}
		}
	}
	[HarmonyPatch(typeof(GlowstickInstance), "Setup")]
	internal class Inject_GlowStick
	{
		private static void Postfix(GlowstickInstance __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			__instance.m_LightColorTarget *= 1.8974999f;
		}
	}
	[HarmonyPatch(typeof(LocalPlayerAgent), "Setup")]
	internal class Inject_LocalPlayerAgent_Ambience
	{
		private static void Postfix(LocalPlayerAgent __instance)
		{
			//IL_0006: 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)
			__instance.m_ambientLightColor = ColorExt.Hex("#6ee7ff") * 1f;
			if ((Object)(object)__instance.m_ambientLight != (Object)null)
			{
				EffectLight ambientLight = __instance.m_ambientLight;
				((LightBase)ambientLight).Range = ((LightBase)ambientLight).Range * 0.99f;
				EffectLight ambientLight2 = __instance.m_ambientLight;
				((LightBase)ambientLight2).Intensity = ((LightBase)ambientLight2).Intensity * (3.333f * CFG.Emission.PlayerAmbientIntensity);
			}
		}
	}
	[HarmonyPatch(typeof(ScoutAntenna), "Init")]
	internal class Inject_ScoutAnt
	{
		private static void Postfix(ScoutAntenna __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			__instance.m_colorDefault *= 2.2275f * CFG.Emission.ScoutAntGlowScale;
			__instance.m_colorDetection *= 2.2275f * CFG.Emission.ScoutAntGlowScale;
		}
	}
}
namespace OldSchoolGraphics.Controllers
{
	internal static class EmissionUpdater
	{
		private static readonly Dictionary<int, EmissionInfo> _Lookup = new Dictionary<int, EmissionInfo>();

		private const float BASE_MULT = 1.625f;

		private static readonly EmissiveShaderInfo[] _ESInfos = new EmissiveShaderInfo[6]
		{
			new ESI_Standard(),
			new ESI_CMSWorldProp(),
			new ESI_DisplayHologram(),
			new ESI_DisplayGearShader(),
			new ESI_GearShader(),
			new ESI_CustomGearShader()
		};

		private static readonly Dictionary<string, float> _MaterialIntensityOverrides = new Dictionary<string, float>
		{
			{ "ApexLights", 1.05f },
			{ "terminal_display_screen", 1.22f },
			{ "MWP", 1.05f },
			{ "prop_Datacenter_Databall_1", 1.15f },
			{ "DefoggerBig", 1.05f }
		};

		public static void Init()
		{
			EmissiveShaderInfo.Initialize();
			EmissiveShaderInfo[] eSInfos = _ESInfos;
			for (int i = 0; i < eSInfos.Length; i++)
			{
				eSInfos[i].Setup();
			}
			LevelAPI.OnBuildDone += OnBuildDone;
			LevelAPI.OnLevelCleanup += OnLevelCleanup;
		}

		private static void OnLevelCleanup()
		{
			foreach (EmissionInfo value in _Lookup.Values)
			{
				value.Reset();
			}
			_Lookup.Clear();
		}

		private static void OnBuildDone()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			Stopwatch stopwatch = new Stopwatch();
			stopwatch.Restart();
			Il2CppReferenceArray<Object> val = Object.FindObjectsOfTypeIncludingAssets(Il2CppType.Of<Renderer>());
			Add(((IEnumerable<Object>)val).Select((Object x) => ((Il2CppObjectBase)x).Cast<Renderer>().sharedMaterial).ToArray());
			stopwatch.Stop();
			bool flag = default(bool);
			BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(19, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Time Elapsed: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<long>(stopwatch.ElapsedTicks);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" (");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<long>(stopwatch.ElapsedMilliseconds);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("ms)");
			}
			Logger.Error(val2);
			val2 = new BepInExErrorLogInterpolatedStringHandler(30, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Items: Valid items: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(_Lookup.Count);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" / out of ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(((Il2CppArrayBase<Object>)(object)val).Count);
			}
			Logger.Error(val2);
		}

		public static void Add(Material[] materials)
		{
			int num = materials.Length;
			for (int i = 0; i < num; i++)
			{
				Add(materials[i]);
			}
		}

		public static void Add(Material material)
		{
			if (!((Object)(object)material == (Object)null) && !((Object)(object)material.shader == (Object)null) && !_Lookup.ContainsKey(((Object)material).GetInstanceID()) && Evaluate(material, out EmissionInfo info))
			{
				info.BaseMultiplier = 1.625f;
				if (_MaterialIntensityOverrides.TryGetValue(((Object)material).name, out var value))
				{
					info.BaseMultiplier = value;
				}
				info.UpdateEmission(CFG.Emission.ObjectBloomScale);
				_Lookup[((Object)material).GetInstanceID()] = info;
			}
		}

		public static void UpdateAllEmission(float multiplier)
		{
			foreach (EmissionInfo value in _Lookup.Values)
			{
				value.UpdateEmission(multiplier);
			}
		}

		private static bool Evaluate(Material material, out EmissionInfo info)
		{
			int num = _ESInfos.Length;
			for (int i = 0; i < num; i++)
			{
				EmissiveShaderInfo emissiveShaderInfo = _ESInfos[i];
				if (emissiveShaderInfo.IsValid(material))
				{
					info = emissiveShaderInfo.CreateInfo(material);
					return info != null;
				}
			}
			info = null;
			return false;
		}
	}
	internal class EmissionInfo
	{
		public Material SharedMaterial;

		public Color OriginalColor;

		public int PropertyID;

		public float BaseMultiplier;

		public static EmissionInfo Create(Material material, int colorProperty)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			return new EmissionInfo
			{
				SharedMaterial = material,
				PropertyID = colorProperty,
				OriginalColor = material.GetColor(colorProperty)
			};
		}

		public void UpdateEmission(float multiplier)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			SharedMaterial.SetColor(PropertyID, OriginalColor * multiplier * BaseMultiplier);
		}

		public void Reset()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			SharedMaterial.SetColor(PropertyID, OriginalColor);
		}
	}
	internal static class OldSchoolSettings
	{
		public const float EMISSION_MULT = 1.65f;

		private static ScreenGrains _ScreenGrains;

		private static FogPrelit _FogPrelit;

		public static void AddGraphicComponents(FPSCamera fpsCam)
		{
			_ScreenGrains = ((Component)fpsCam).gameObject.AddComponent<ScreenGrains>();
			_ScreenGrains.Setup();
			_FogPrelit = ((Component)fpsCam).gameObject.AddComponent<FogPrelit>();
			_FogPrelit.Setup();
		}

		public static void ApplyPPSettings(FPSCamera fpsCam)
		{
			if (CFG.Graphic.ForceOffWetness)
			{
				Shader.SetGlobalFloat("_GlobalWetness", 0f);
			}
			Shader.SetGlobalFloat("_DitherAmount", CFG.Graphic.DitherScale);
			UpdateGraphicComponents(fpsCam);
			UpdatePostProcessing(fpsCam);
		}

		private static void UpdateGraphicComponents(FPSCamera fpsCam)
		{
			if ((Object)(object)_ScreenGrains != (Object)null)
			{
				_ScreenGrains.UpdateIntensity(CFG.Graphic.NoiseScale);
			}
			if ((Object)(object)fpsCam.PrelitVolume != (Object)null)
			{
				PreLitVolume prelitVolume = fpsCam.PrelitVolume;
				prelitVolume.mode = (AccumulationMode)1;
				prelitVolume.DensityBoost = CFG.FogLit.FogBoost;
				prelitVolume.IndirectIntensity = CFG.FogLit.Indirect;
				prelitVolume.ReflectionIntensity = CFG.FogLit.IndirectReflection;
				prelitVolume.IndirectFogOpacity = 1f;
			}
			if ((Object)(object)fpsCam.AmbientParticles != (Object)null)
			{
				Material material = fpsCam.AmbientParticles.material;
				float dustScale = CFG.Graphic.DustScale;
				material.SetFloat("_SizeMin", 0.002f * dustScale);
				material.SetFloat("_SizeMax", 0.003f * dustScale);
			}
			if ((Object)(object)fpsCam.m_amplifyOcclusion != (Object)null)
			{
				fpsCam.m_amplifyOcclusion.BlurEnabled = false;
			}
			SSS component = ((Component)fpsCam).gameObject.GetComponent<SSS>();
			if ((Object)(object)component != (Object)null)
			{
				component.occlusionColoring = 0f;
			}
		}

		private static void UpdatePostProcessing(FPSCamera fpsCam)
		{
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			fpsCam.SetBloomEnabled(true);
			Enumerator<PostProcessEffectSettings> enumerator = fpsCam.postProcessing.m_ppVolume.profile.settings.GetEnumerator();
			while (enumerator.MoveNext())
			{
				PostProcessEffectSettings current = enumerator.Current;
				Bloom to2;
				ColorGrading to3;
				Vignette to4;
				if (TryCast<PostProcessEffectSettings, AutoExposure>(current, out AutoExposure to))
				{
					((ParameterOverride<float>)(object)to.minLuminance).value = 1f;
					((ParameterOverride<float>)(object)to.maxLuminance).value = 1f;
					((ParameterOverride<float>)(object)to.keyValue).value = 11.3f * CFG.Graphic.ExposureScale;
				}
				else if (TryCast<PostProcessEffectSettings, Bloom>(current, out to2))
				{
					((ParameterOverride<float>)(object)to2.intensity).value = 0.99f * CFG.Emission.BloomIntensity;
					((ParameterOverride<float>)(object)to2.diffusion).value = CFG.Emission.BloomSpread;
					((ParameterOverride<float>)(object)to2.anamorphicRatio).value = -0.25f;
					((ParameterOverride<float>)(object)to2.dirtIntensity).value = 0.9f;
					((ParameterOverride<float>)(object)to2.threshold).value = CFG.Emission.BloomThreshold;
					((ParameterOverride<float>)(object)to2.softKnee).value = 0f;
					((ParameterOverride<float>)(object)to2.clamp).value = 600000f;
					((ParameterOverride<float>)(object)to2.dirtIntensity).value = CFG.Emission.BloomDirtIntensity;
				}
				else if (TryCast<PostProcessEffectSettings, ColorGrading>(current, out to3))
				{
					((ParameterOverride<GradingMode>)(object)to3.gradingMode).value = (GradingMode)1;
					((ParameterOverride<Tonemapper>)(object)to3.tonemapper).value = (Tonemapper)2;
					((ParameterOverride<float>)(object)to3.postExposure).value = 1.2f;
					((ParameterOverride<float>)(object)to3.contrast).value = 0.6f * CFG.Graphic.ContrastScale;
					((ParameterOverride<float>)(object)to3.saturation).value = CFG.Graphic.ColorSaturation;
					((ParameterOverride<Vector4>)(object)to3.lift).value = new Vector4(1f, 1f, 1f, CFG.Graphic.LiftLevel);
					((ParameterOverride<Vector4>)(object)to3.gamma).value = new Vector4(1f, 1f, 1f, CFG.Graphic.GammaLevel);
					((ParameterOverride<Vector4>)(object)to3.gain).value = new Vector4(1f, 1f, 1f, CFG.Graphic.GainLevel);
				}
				else if (TryCast<PostProcessEffectSettings, Vignette>(current, out to4))
				{
					((PostProcessEffectSettings)to4).active = false;
					((ParameterOverride<bool>)(object)((PostProcessEffectSettings)to4).enabled).value = false;
					((ParameterOverride<float>)(object)to4.intensity).value = 0f;
				}
			}
		}

		private static bool TryCast<F, T>(F from, out T to) where F : Il2CppObjectBase where T : Il2CppObjectBase
		{
			to = ((Il2CppObjectBase)from).TryCast<T>();
			return to != null;
		}
	}
}
namespace OldSchoolGraphics.Controllers.ShaderInfos
{
	internal abstract class EmissiveShaderInfo
	{
		protected static int Prop_EmissiveColor { get; private set; }

		protected static int Prop_EmissionColor { get; private set; }

		protected static int Prop_EnableEmissive { get; private set; }

		protected Shader ShaderAsset { get; private set; }

		protected abstract string ShaderAssetPath { get; }

		protected int ShaderInstanceID { get; private set; }

		public static void Initialize()
		{
			Prop_EmissiveColor = Shader.PropertyToID("_EmissiveColor");
			Prop_EmissionColor = Shader.PropertyToID("_EmissionColor");
			Prop_EnableEmissive = Shader.PropertyToID("_EnableEmissive");
		}

		public EmissiveShaderInfo Setup()
		{
			ShaderAsset = Shader.Find(ShaderAssetPath);
			ShaderInstanceID = ((Object)ShaderAsset).GetInstanceID();
			return this;
		}

		public bool IsValid(Material material)
		{
			if ((Object)(object)material == (Object)null)
			{
				return false;
			}
			Shader shader = material.shader;
			if ((Object)(object)shader == (Object)null)
			{
				return false;
			}
			if (((Object)shader).GetInstanceID() != ShaderInstanceID)
			{
				return false;
			}
			return IsEmissiveMaterial(material);
		}

		public EmissionInfo CreateInfo(Material material)
		{
			if (TryCreateInfo(material, out EmissionInfo info))
			{
				return info;
			}
			return null;
		}

		protected virtual bool IsEmissiveMaterial(Material material)
		{
			return true;
		}

		protected abstract bool TryCreateInfo(Material material, out EmissionInfo info);
	}
	internal sealed class ESI_CMSWorldProp : EmissiveShaderInfo
	{
		protected override string ShaderAssetPath => "GTFO/CMS_WorldProp";

		protected override bool IsEmissiveMaterial(Material material)
		{
			return material.GetFloat(EmissiveShaderInfo.Prop_EnableEmissive) >= 1f;
		}

		protected override bool TryCreateInfo(Material material, out EmissionInfo info)
		{
			info = EmissionInfo.Create(material, EmissiveShaderInfo.Prop_EmissiveColor);
			return true;
		}
	}
	internal sealed class ESI_CustomGearShader : EmissiveShaderInfo
	{
		protected override string ShaderAssetPath => "Cell/Player/CustomGearShader";

		protected override bool TryCreateInfo(Material material, out EmissionInfo info)
		{
			info = EmissionInfo.Create(material, EmissiveShaderInfo.Prop_EmissiveColor);
			return true;
		}
	}
	internal sealed class ESI_DisplayGearShader : EmissiveShaderInfo
	{
		protected override string ShaderAssetPath => "Cell/Player/Display_GearShader";

		protected override bool IsEmissiveMaterial(Material material)
		{
			return material.IsKeywordEnabled("_EMISSION");
		}

		protected override bool TryCreateInfo(Material material, out EmissionInfo info)
		{
			info = EmissionInfo.Create(material, EmissiveShaderInfo.Prop_EmissiveColor);
			return true;
		}
	}
	internal sealed class ESI_DisplayHologram : EmissiveShaderInfo
	{
		protected override string ShaderAssetPath => "Cell/Player/Display_Hologram";

		protected override bool TryCreateInfo(Material material, out EmissionInfo info)
		{
			info = EmissionInfo.Create(material, EmissiveShaderInfo.Prop_EmissiveColor);
			return true;
		}
	}
	internal sealed class ESI_GearShader : EmissiveShaderInfo
	{
		protected override string ShaderAssetPath => "Cell/Player/GearShader";

		protected override bool IsEmissiveMaterial(Material material)
		{
			return material.IsKeywordEnabled("ENABLE_EMISSIVE");
		}

		protected override bool TryCreateInfo(Material material, out EmissionInfo info)
		{
			info = EmissionInfo.Create(material, EmissiveShaderInfo.Prop_EmissiveColor);
			return true;
		}
	}
	internal sealed class ESI_Standard : EmissiveShaderInfo
	{
		protected override string ShaderAssetPath => "Standard";

		protected override bool IsEmissiveMaterial(Material material)
		{
			return material.IsKeywordEnabled("_EMISSION");
		}

		protected override bool TryCreateInfo(Material material, out EmissionInfo info)
		{
			info = EmissionInfo.Create(material, EmissiveShaderInfo.Prop_EmissionColor);
			return true;
		}
	}
}
namespace OldSchoolGraphics.Configurations
{
	internal static class CFG
	{
		private static ConfigFile _Config;

		public static CFG_Graphics Graphic { get; private set; } = new CFG_Graphics();


		public static CFG_Emissions Emission { get; private set; } = new CFG_Emissions();


		public static CFG_FogLit FogLit { get; private set; } = new CFG_FogLit();


		public static CFG_User User { get; private set; } = new CFG_User();


		public static CFG_Debug DEBUG { get; private set; } = new CFG_Debug();


		internal static void Initialize(string configFileName)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			_Config = new ConfigFile(Path.Combine(Paths.ConfigPath, configFileName), true);
			Graphic.Initialize(_Config);
			Emission.Initialize(_Config);
			FogLit.Initialize(_Config);
			User.Initialize(_Config);
			LiveEditListener obj = LiveEdit.CreateListener(Paths.ConfigPath, configFileName, false);
			obj.FileChangedEventCooldown = 0.75f;
			obj.FileChanged += new LiveEditEventHandler(CFG_FileChanged);
		}

		private static void CFG_FileChanged(LiveEditEventArgs e)
		{
			CoroutineDispatcher.StartCoroutine(ReloadConfig());
		}

		private static IEnumerator ReloadConfig()
		{
			while (true)
			{
				try
				{
					_Config.Reload();
					Reloaded();
					break;
				}
				catch
				{
				}
				yield return null;
			}
		}

		private static void Reloaded()
		{
			if (LocalPlayer.TryGetFPSCam(out FPSCamera fpsCam))
			{
				OldSchoolSettings.ApplyPPSettings(fpsCam);
				Logger.Warn("Reloading Config");
			}
			EmissionUpdater.UpdateAllEmission(Emission.ObjectBloomScale);
			Logger.Warn("Adjusting Object Bloom");
		}
	}
	internal sealed class CFG_Debug
	{
		private const string SECTION = "0. Debug";

		[Conditional("DEBUG")]
		internal void Initialize(ConfigFile cfg)
		{
		}

		[Conditional("DEBUG")]
		internal void UpdateValue()
		{
		}
	}
	internal sealed class CFG_Emissions
	{
		private const string SECTION = "2. Emissions";

		private ConfigEntry<float> _FlashlightIntensity;

		private ConfigEntry<float> _PlayerAmbientIntensity;

		private ConfigEntry<float> _BloomIntensity;

		private ConfigEntry<float> _BloomSpread;

		private ConfigEntry<float> _BloomDirtIntensity;

		private ConfigEntry<float> _BloomThreshold;

		private ConfigEntry<float> _ObjectBloomScale;

		private ConfigEntry<float> _EnemyGlowScale;

		private ConfigEntry<float> _EnemyGlowCap;

		private ConfigEntry<float> _ScoutAntGlowScale;

		public float FlashlightIntenisty => _FlashlightIntensity.Value;

		public float PlayerAmbientIntensity => _PlayerAmbientIntensity.Value;

		public float BloomIntensity => _BloomIntensity.Value;

		public float BloomSpread => _BloomSpread.Value;

		public float BloomThreshold => _BloomThreshold.Value;

		public float BloomDirtIntensity => _BloomDirtIntensity.Value;

		public float ObjectBloomScale => _ObjectBloomScale.Value;

		public float EnemyGlowScale => _EnemyGlowScale.Value;

		public float EnemyGlowCap => _EnemyGlowCap.Value;

		public float ScoutAntGlowScale => _ScoutAntGlowScale.Value;

		internal void Initialize(ConfigFile cfg)
		{
			_FlashlightIntensity = cfg.Bind<float>("2. Emissions", "Flashlight Intensity", 0.35f, (ConfigDescription)null);
			_PlayerAmbientIntensity = cfg.Bind<float>("2. Emissions", "Player Ambient Intensity", 0.52f, (ConfigDescription)null);
			_BloomIntensity = cfg.Bind<float>("2. Emissions", "Bloom Intensity", 0.85f, (ConfigDescription)null);
			_BloomSpread = cfg.Bind<float>("2. Emissions", "Bloom Spread", 9f, "Value Range (0.0 ~ 10.0)");
			_BloomDirtIntensity = cfg.Bind<float>("2. Emissions", "Bloom Dirt Intensity", 15f, (ConfigDescription)null);
			_BloomThreshold = cfg.Bind<float>("2. Emissions", "Bloom Threshold", 0.45f, (ConfigDescription)null);
			_ObjectBloomScale = cfg.Bind<float>("2. Emissions", "Object Bloom Scale", 1f, (ConfigDescription)null);
			_EnemyGlowScale = cfg.Bind<float>("2. Emissions", "Sleeper Glow Scale", 1f, (ConfigDescription)null);
			_EnemyGlowCap = cfg.Bind<float>("2. Emissions", "Sleeper Glow Cap Limit", 25f, (ConfigDescription)null);
			_ScoutAntGlowScale = cfg.Bind<float>("2. Emissions", "Scout Antenna Glow Scale", 0.92f, (ConfigDescription)null);
		}
	}
	internal sealed class CFG_FogLit
	{
		private const string SECTION = "3. Fog Lit System";

		private ConfigEntry<float> _FogBoost;

		private ConfigEntry<float> _Indirect;

		private ConfigEntry<float> _IndirectReflection;

		private ConfigEntry<float> _SpotColorMaxCap;

		private ConfigEntry<float> _SpotColorScale;

		private ConfigEntry<float> _PointColorMaxCap;

		private ConfigEntry<float> _PointColorScale;

		private ConfigEntry<float> _EffectColorScale;

		private ConfigEntry<float> _LitAdjustment_MaxDensity;

		private ConfigEntry<float> _LitAdjustment_MinDensity;

		private ConfigEntry<float> _LitAdjustment_DensityBonusAmount;

		private ConfigEntry<float> _LitAdjustment_IntensityToRangeWeight;

		public float FogBoost => _FogBoost.Value;

		public float Indirect => _Indirect.Value;

		public float IndirectReflection => _IndirectReflection.Value;

		public float SpotColorMaxCap => _SpotColorMaxCap.Value;

		public float SpotColorScale => _SpotColorScale.Value;

		public float PointColorMaxCap => _PointColorMaxCap.Value;

		public float PointColorScale => _PointColorScale.Value;

		public float EffectColorScale => _EffectColorScale.Value;

		public float LitAdjustment_MaxDensity => _LitAdjustment_MaxDensity.Value;

		public float LitAdjustment_MinDensity => _LitAdjustment_MinDensity.Value;

		public float LitAdjustment_DensityBonusAmount => _LitAdjustment_DensityBonusAmount.Value;

		public float LitAdjustment_IntensityToRangeWeight => _LitAdjustment_IntensityToRangeWeight.Value;

		internal void Initialize(ConfigFile cfg)
		{
			_FogBoost = cfg.Bind<float>("3. Fog Lit System", "Fog Density Boost", 0.55f, (ConfigDescription)null);
			_Indirect = cfg.Bind<float>("3. Fog Lit System", "Indirect Intensity", 0.525f, (ConfigDescription)null);
			_IndirectReflection = cfg.Bind<float>("3. Fog Lit System", "Indirect Reflection", 0.16f, (ConfigDescription)null);
			_SpotColorMaxCap = cfg.Bind<float>("3. Fog Lit System", "Spot Light Intensity Max Cap", 0.0175f, (ConfigDescription)null);
			_SpotColorScale = cfg.Bind<float>("3. Fog Lit System", "Spot Light Color Scale", 1f, (ConfigDescription)null);
			_PointColorMaxCap = cfg.Bind<float>("3. Fog Lit System", "Point Light Intensity Max Cap", 0.0265f, (ConfigDescription)null);
			_PointColorScale = cfg.Bind<float>("3. Fog Lit System", "Point Light Color Scale", 1f, (ConfigDescription)null);
			_EffectColorScale = cfg.Bind<float>("3. Fog Lit System", "Effect Light Color Scale", 9f, (ConfigDescription)null);
			_LitAdjustment_MaxDensity = cfg.Bind<float>("3. Fog Lit System", "(ADV) LitAdjust / MaxLit FogDensity", 0f, (ConfigDescription)null);
			_LitAdjustment_MinDensity = cfg.Bind<float>("3. Fog Lit System", "(ADV) LitAdjust / MinLit FogDensity", 0.05f, (ConfigDescription)null);
			_LitAdjustment_DensityBonusAmount = cfg.Bind<float>("3. Fog Lit System", "(ADV) LitAdjust / Density Bonus Amount", 0.001f, (ConfigDescription)null);
			_LitAdjustment_IntensityToRangeWeight = cfg.Bind<float>("3. Fog Lit System", "(ADV) LitAdjust / Intensity To Range Weight", 15f, (ConfigDescription)null);
		}
	}
	internal sealed class CFG_Graphics
	{
		private const string SECTION = "1. Graphics";

		private ConfigEntry<float> _ExposureScale;

		private ConfigEntry<float> _NoiseScale;

		private ConfigEntry<float> _DitherScale;

		private ConfigEntry<float> _ContrastFactor;

		private ConfigEntry<float> _DustScale;

		private ConfigEntry<float> _ColorSaturation;

		private ConfigEntry<float> _LiftLevel;

		private ConfigEntry<float> _GammaLevel;

		private ConfigEntry<float> _GainLevel;

		private ConfigEntry<bool> _ForceOffWetness;

		public float ExposureScale => _ExposureScale.Value;

		public float NoiseScale => _NoiseScale.Value;

		public float DitherScale => _DitherScale.Value;

		public float ContrastScale => _ContrastFactor.Value;

		public float DustScale => _DustScale.Value;

		public float ColorSaturation => _ColorSaturation.Value;

		public float LiftLevel => _LiftLevel.Value;

		public float GammaLevel => _GammaLevel.Value;

		public float GainLevel => _GainLevel.Value;

		public bool ForceOffWetness => _ForceOffWetness.Value;

		internal void Initialize(ConfigFile cfg)
		{
			_ExposureScale = cfg.Bind<float>("1. Graphics", "Exposure Scale", 1.95f, (ConfigDescription)null);
			_NoiseScale = cfg.Bind<float>("1. Graphics", "Noise Scale", 0.85f, (ConfigDescription)null);
			_DitherScale = cfg.Bind<float>("1. Graphics", "Dither Scale", 0f, (ConfigDescription)null);
			_ContrastFactor = cfg.Bind<float>("1. Graphics", "Contrast Factor", 5f, (ConfigDescription)null);
			_DustScale = cfg.Bind<float>("1. Graphics", "Dust Particle Scale", 0.6f, (ConfigDescription)null);
			_ColorSaturation = cfg.Bind<float>("1. Graphics", "Color Saturation (Stronger Color)", -6.5f, "Value Range (-100.0 ~ 100.0)");
			_LiftLevel = cfg.Bind<float>("1. Graphics", "Lift Level (Dark Color)", -0.06f, (ConfigDescription)null);
			_GammaLevel = cfg.Bind<float>("1. Graphics", "Gamma Level (Mid Color)", -0.17f, (ConfigDescription)null);
			_GainLevel = cfg.Bind<float>("1. Graphics", "Gain Level (Bright Color)", 0.4f, (ConfigDescription)null);
			_ForceOffWetness = cfg.Bind<bool>("1. Graphics", "Force Off Wetness", true, (ConfigDescription)null);
		}
	}
	internal class CFG_User
	{
		private const string SECTION = "4. User Preferences / Minor";

		private ConfigEntry<MeleeOverride> _MeleeType;

		private ConfigEntry<float> _FlashlightSwayFactor;

		public MeleeOverride MeleeType => _MeleeType.Value;

		public float FlashlightSwayFactor => _FlashlightSwayFactor.Value;

		internal void Initialize(ConfigFile cfg)
		{
			_MeleeType = cfg.Bind<MeleeOverride>("4. User Preferences / Minor", "Hammer Model", MeleeOverride.Default, (ConfigDescription)null);
			_FlashlightSwayFactor = cfg.Bind<float>("4. User Preferences / Minor", "Flashlight Sway Movement", 0.25f, "(0.0 - 1.0) Lower = less movement from center");
		}
	}
	internal enum MeleeOverride
	{
		Default,
		Gavel,
		Maul,
		Sledgehammer,
		Mallet
	}
}
namespace OldSchoolGraphics.Comps
{
	internal class DebugBehaviour : MonoBehaviour
	{
		public static DebugBehaviour Current;

		public int RTWidth;

		public int RTHeight;

		public RenderTexture Buffer1;

		public RenderTexture Buffer2;

		public RenderTexture Buffer3;

		public ComputeShader CS;

		public int Kernel;

		private void Start()
		{
			Current = this;
			Buffer1 = CreateTexture(Screen.width / 8, Screen.height / 8);
			Buffer2 = CreateTexture(Screen.width / 8, Screen.height / 8);
			Buffer3 = CreateTexture(Screen.width / 8, Screen.height / 8);
			CS = AssetAPI.GetLoadedAsset<ComputeShader>("Assets/Modding/OSG/FogDebugger.compute");
			Kernel = CS.FindKernel("CSMain");
		}

		private RenderTexture CreateTexture(int width, int height)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			RenderTexture val = new RenderTexture(width, height, 0)
			{
				dimension = (TextureDimension)2,
				format = (RenderTextureFormat)11,
				enableRandomWrite = true,
				useMipMap = false,
				filterMode = (FilterMode)2
			};
			val.Create();
			((Object)val).hideFlags = (HideFlags)61;
			return val;
		}

		private void AllocTexture(int width, int height)
		{
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			if ((Object)(object)Buffer1 != (Object)null)
			{
				Object.Destroy((Object)(object)Buffer1);
			}
			if ((Object)(object)Buffer2 != (Object)null)
			{
				Object.Destroy((Object)(object)Buffer2);
			}
			if ((Object)(object)Buffer3 != (Object)null)
			{
				Object.Destroy((Object)(object)Buffer3);
			}
			Buffer1 = CreateTexture(width, height);
			Buffer2 = CreateTexture(width, height);
			Buffer3 = CreateTexture(width, height);
			CS.SetTexture(Kernel, "_Tex1", (Texture)(object)Buffer1);
			CS.SetTexture(Kernel, "_Tex2", (Texture)(object)Buffer2);
			CS.SetTexture(Kernel, "_Tex3", (Texture)(object)Buffer3);
			RTWidth = width;
			RTHeight = height;
			bool flag = default(bool);
			BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(21, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Textured Allocated: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(width);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("x");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(height);
			}
			Logger.Error(val);
		}

		private void Update()
		{
			if ((Object)(object)PreLitVolume.Current != (Object)null)
			{
				PreLitVolume current = PreLitVolume.Current;
				if (((Texture)current.m_fogVolume).width != RTWidth || ((Texture)current.m_fogVolume).height != RTHeight)
				{
					AllocTexture(((Texture)current.m_fogVolume).width, ((Texture)current.m_fogVolume).height);
				}
				CS.SetTexture(Kernel, "_FogVolume", (Texture)(object)PreLitVolume.Current.m_fogVolume);
			}
			Input.GetKeyDown((KeyCode)127);
		}

		public static void Dispatch(CommandBuffer cmd, Texture tex, int x, int y, int z)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			cmd.SetComputeTextureParam(Current.CS, Current.Kernel, "_FogVolume", RenderTargetIdentifier.op_Implicit(tex));
			cmd.DispatchCompute(Current.CS, Current.Kernel, x, y, z);
		}
	}
	internal sealed class FogPrelit : MonoBehaviour
	{
		public static FogPrelit Current;

		private Il2CppStructArray<Vector4> _Arr_Vec1;

		private Il2CppStructArray<Vector4> _Arr_Vec2;

		private Il2CppStructArray<Matrix4x4> _Arr_Matrix;

		private Il2CppStructArray<float> _Arr_Float1;

		private Color _PrelitColor;

		private float _PrelitRange;

		public void Setup()
		{
			_Arr_Vec1 = new Il2CppStructArray<Vector4>(32L);
			_Arr_Vec2 = new Il2CppStructArray<Vector4>(32L);
			_Arr_Matrix = new Il2CppStructArray<Matrix4x4>(32L);
			_Arr_Float1 = new Il2CppStructArray<float>(32L);
		}

		private void Start()
		{
			Current = this;
		}

		private void OnDestroy()
		{
		}

		public void UpdateClusteredEntry(ClusteredRendering cr, CommandBuffer cmd)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_006c: 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)
			_ = PreLitVolume.Current;
			for (int i = 0; i < ((Il2CppArrayBase<Vector4>)(object)_Arr_Vec1).Length; i++)
			{
				Color val = Color.op_Implicit(((Il2CppArrayBase<Vector4>)(object)cr.m_effectColorPhysical)[i]);
				Color val2 = ((Color)(ref val)).linear;
				float num = Mathf.Max(new float[3] { val2.r, val2.g, val2.b });
				if (num > CFG.FogLit.PointColorMaxCap)
				{
					val2 = val2 / num * CFG.FogLit.PointColorMaxCap;
				}
				val2 = ((Color)(ref val2)).RGBMultiplied(CFG.FogLit.EffectColorScale);
				val2.a = 1f;
				((Il2CppArrayBase<Vector4>)(object)_Arr_Vec1)[i] = Color.op_Implicit(val2);
			}
			cmd.SetGlobalVectorArray(ClusteredRendering._EffectColorPhysical, _Arr_Vec1);
		}

		public void RevertClusteredEntry(ClusteredRendering cr, CommandBuffer cmd)
		{
			cmd.SetGlobalVectorArray(ClusteredRendering._EffectColorPhysical, cr.m_effectColorPhysical);
		}

		private void Update()
		{
			Enumerator<C_Light> enumerator = C_CullingManager.VisibleSpotLights.GetEnumerator();
			while (enumerator.MoveNext())
			{
				CL_Light clusterLight = enumerator.Current.m_clusterLight;
				if ((Object)(object)clusterLight != (Object)null)
				{
					clusterLight.UpdateData();
				}
			}
			enumerator = C_CullingManager.VisiblePointLights.GetEnumerator();
			while (enumerator.MoveNext())
			{
				CL_Light clusterLight2 = enumerator.Current.m_clusterLight;
				if ((Object)(object)clusterLight2 != (Object)null)
				{
					clusterLight2.UpdateData();
				}
			}
		}
	}
	internal class ScreenBlackAndWhite : MonoBehaviour
	{
		private Material _BWMat;

		private Shader _BWShader;

		private CommandBuffer _Cmd;

		private readonly List<Transform> _TrackingTransforms = new List<Transform>();

		public static ScreenBlackAndWhite Instance { get; private set; }

		private void Start()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			Instance = this;
			_BWMat = AssetAPI.GetLoadedAsset<Material>("Assets/OSG/BAWMat.mat");
			_BWShader = AssetAPI.GetLoadedAsset<Shader>("Assets/OSG/BlackAndWhite.shader");
			_Cmd = new CommandBuffer();
			_Cmd.name = "loadout player black and white command";
			((Component)this).GetComponent<Camera>().AddCommandBuffer((CameraEvent)5, _Cmd);
		}

		public void UpdateCommand()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Invalid comparison between Unknown and I4
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			_Cmd.Clear();
			foreach (Transform trackingTransform in _TrackingTransforms)
			{
				foreach (MeshRenderer componentsInChild in ((Component)trackingTransform).GetComponentsInChildren<MeshRenderer>())
				{
					if ((int)((Renderer)componentsInChild).shadowCastingMode != 3 && (int)((Renderer)componentsInChild).shadowCastingMode != 0 && ((Renderer)componentsInChild).enabled)
					{
						((Component)componentsInChild).gameObject.layer = LayerManager.LAYER_DEBRIS;
						Material val = new Material(_BWShader);
						val.mainTexture = ((Renderer)componentsInChild).material.mainTexture;
						_Cmd.DrawRenderer((Renderer)(object)componentsInChild, val);
					}
				}
				foreach (SkinnedMeshRenderer componentsInChild2 in ((Component)trackingTransform).GetComponentsInChildren<SkinnedMeshRenderer>())
				{
					if ((int)((Renderer)componentsInChild2).shadowCastingMode != 3 && (int)((Renderer)componentsInChild2).shadowCastingMode != 0 && ((Renderer)componentsInChild2).enabled)
					{
						((Component)componentsInChild2).gameObject.layer = LayerManager.LAYER_DEBRIS;
						componentsInChild2.updateWhenOffscreen = true;
						new Material(_BWShader).mainTexture = ((Renderer)componentsInChild2).material.mainTexture;
						_Cmd.DrawRenderer((Renderer)(object)componentsInChild2, _BWMat);
					}
				}
			}
		}

		public void AddTrackingTransform(Transform playerModelRoot)
		{
			_TrackingTransforms.Add(playerModelRoot);
		}

		public void RemoveTrackingTransform(Transform playerModelRoot)
		{
			Transform playerModelRoot2 = playerModelRoot;
			int num = _TrackingTransforms.FindIndex((Transform x) => ((Object)x).GetInstanceID() == ((Object)playerModelRoot2).GetInstanceID());
			if (num >= 0)
			{
				_TrackingTransforms.RemoveAt(num);
			}
		}
	}
	internal class ScreenGrains : MonoBehaviour
	{
		private NoiseAndGrain _Noise;

		private int _NoiseTextureIndex;

		[HideFromIl2Cpp]
		public void Setup()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			Camera component = ((Component)this).gameObject.GetComponent<Camera>();
			_Noise = ((Component)component).gameObject.AddComponent<NoiseAndGrain>();
			_Noise.noiseShader = Shader.Find("Hidden/NoiseAndGrain");
			_Noise.dx11NoiseShader = Shader.Find("Hidden/NoiseAndGrainDX11");
			_Noise.noiseTexture = GetTexture();
			_Noise.tiling = Vector3.one;
			_Noise.blackIntensity = 0.41f;
			_Noise.whiteIntensity = 0.61f;
			_Noise.generalIntensity = 0.4f;
			_Noise.softness = 0f;
			_Noise.filterMode = (FilterMode)0;
			_Noise.monochrome = true;
		}

		[HideFromIl2Cpp]
		public void UpdateIntensity(float intensity)
		{
			_Noise.intensityMultiplier = intensity;
		}

		[HideFromIl2Cpp]
		private Texture2D GetTexture()
		{
			if (_NoiseTextureIndex > PE_BlueNoise.cNoiseLayers - 2)
			{
				_NoiseTextureIndex = 0;
			}
			return ((Il2CppArrayBase<Texture2D>)(object)PE_BlueNoise.Singleton.m_noiseTextures)[_NoiseTextureIndex++];
		}
	}
}