HighDef.dll

Decompiled 4 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace LCHD;

[BepInPlugin("ChubbzCrew.LCHD", "Lethal Company High Definition", "1.1.5")]
[BepInProcess("Lethal Company.exe")]
public class Initializer : BaseUnityPlugin
{
	public void OnDestroy()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		GameObject val = new GameObject("RemoverObject");
		Object.DontDestroyOnLoad((Object)(object)val);
		val.AddComponent<Remover>();
	}
}
public class Remover : MonoBehaviour
{
	private bool jobDone = false;

	private bool alreadyWarned = false;

	public HUDManager hud;

	private void Start()
	{
		Object.DontDestroyOnLoad((Object)(object)this);
	}

	private void Update()
	{
		if ((Object)(object)Object.FindObjectOfType<HUDManager>() != (Object)null)
		{
			DisableEffects();
		}
		else
		{
			jobDone = false;
		}
	}

	private void DisableEffects()
	{
		if (!jobDone)
		{
			DisableRenderTextures();
			jobDone = true;
		}
	}

	private void DisablePostProcesses()
	{
		Debug.Log((object)"Attempting to disable custom pass...");
		CustomPassVolume val = Object.FindObjectOfType<CustomPassVolume>();
		if ((Object)(object)val != (Object)null)
		{
			Debug.Log((object)"Outline volume located");
			((Behaviour)val).enabled = false;
			Debug.Log((object)"Custom pass disabled");
			Transform parent = ((Component)val).transform.parent;
			if (!((Object)(object)parent != (Object)null))
			{
				return;
			}
			Transform child = parent.GetChild(2);
			if ((Object)(object)child != (Object)null)
			{
				MeshRenderer componentInChildren = ((Component)child).GetComponentInChildren<MeshRenderer>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					Object.Destroy((Object)(object)componentInChildren);
					Debug.Log((object)"Visor renderer destroyed");
				}
				MeshFilter componentInChildren2 = ((Component)child).GetComponentInChildren<MeshFilter>();
				if ((Object)(object)componentInChildren2 != (Object)null)
				{
					Object.Destroy((Object)(object)componentInChildren2);
					Debug.Log((object)"Visor filter destroyed");
				}
			}
		}
		else if (!alreadyWarned)
		{
			Debug.Log((object)"Unable to find outline volume");
			alreadyWarned = true;
		}
	}

	private void DisableRenderTextures()
	{
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"Attempting to disable render textures...");
		hud = GameObject.Find("PlayersManager / HUDManager").GetComponent<HUDManager>();
		hud.playerScreenTexture = null;
		Camera[] array = Object.FindObjectsOfType<Camera>();
		GameObject val = GameObject.Find("TopLeftCorner");
		Camera[] array2 = array;
		foreach (Camera val2 in array2)
		{
			if ((((Object)((Component)val2).gameObject).name == "MainCamera" || ((Object)((Component)val2).gameObject).name == "SpectateCamera") && (Object)(object)val2.targetTexture != (Object)null)
			{
				val2.targetTexture = null;
				Debug.Log((object)("Disabled render texture for camera: " + ((Object)((Component)val2).gameObject).name));
			}
			if (((Object)((Component)val2).gameObject).name == "UICamera")
			{
				((Component)val2).gameObject.SetActive(false);
				Canvas component = ((Component)((Component)val2).transform.parent.GetChild(1)).gameObject.GetComponent<Canvas>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.renderMode = (RenderMode)0;
				}
			}
		}
		Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>();
		foreach (Transform val3 in componentsInChildren)
		{
			val3.rotation = Quaternion.identity;
		}
		((Component)GameObject.Find("PlayerScreen").transform.parent.parent).gameObject.SetActive(false);
	}

	public void OnDestroy()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		GameObject val = new GameObject("RemoverObject");
		Object.DontDestroyOnLoad((Object)(object)val);
		val.AddComponent<Remover>();
	}
}