Decompiled source of EyeOfProvidence v0.2.2

plugins/EyeOfProvidence/EyeOfProvidence.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using PluginConfig.API;
using PluginConfig.API.Fields;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Rendering;
using UnityEngine.Timeline;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("EyeOfProvidence")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EyeOfProvidence")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4f3178f0-3d13-4083-8082-9c202d685155")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace EyeOfProvidence;

public class AssetHandler
{
	public static AssetBundle bundle;

	public static bool bundleLoaded = false;

	public static Dictionary<string, GameObject> prefabs = new Dictionary<string, GameObject>();

	public static void LoadBundle(string name)
	{
		if (bundleLoaded)
		{
			Debug.Log((object)("AssetBundle " + name + " already loaded"));
			return;
		}
		bundle = AssetBundle.LoadFromFile(Path.Combine(Path.Combine(Utils.ModDir(), "Data"), name));
		if ((Object)(object)bundle != (Object)null)
		{
			Debug.Log((object)("AssetBundle " + name + " successfully loaded"));
			bundleLoaded = true;
		}
		else
		{
			Debug.Log((object)("AssetBundle " + name + " failed to loaded"));
			bundleLoaded = false;
		}
	}

	public static T LoadAsset<T>(string name) where T : Object
	{
		if (!bundleLoaded)
		{
			Debug.Log((object)"Bundle is not loaded");
			return default(T);
		}
		T val = bundle.LoadAsset<T>(name);
		if ((Object)(object)val == (Object)null)
		{
			Debug.Log((object)(name + " didn't load"));
		}
		return val;
	}

	public static void UnloadBundle()
	{
		if (!bundleLoaded)
		{
			Debug.Log((object)"Bundle already unloaded");
			return;
		}
		Debug.Log((object)"Bundle succesfully unloaded");
		bundle.Unload(true);
		bundle = null;
	}
}
public enum PerspectiveMode
{
	Equirectangular,
	Fisheye,
	Stereographic,
	Hammer,
	Panini
}
public static class ConfigManager
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static PostFloatSliderValueChangeEvent <>9__21_0;

		public static PostBoolValueChangeEvent <>9__21_1;

		public static PostEnumValueChangeEvent<PerspectiveMode> <>9__21_2;

		public static PostFloatValueChangeEvent <>9__21_3;

		internal void <Setup>b__21_0(float e, Tuple<float, float> f)
		{
			UpdateValeus();
		}

		internal void <Setup>b__21_1(bool e)
		{
			UpdateValeus();
		}

		internal void <Setup>b__21_2(PerspectiveMode e)
		{
			UpdateValeus();
		}

		internal void <Setup>b__21_3(float e)
		{
			UpdateValeus();
		}
	}

	public static PluginConfigurator config;

	public static BoolField UltraFOV;

	public static FloatField PlayerFOVUncapped;

	public static FloatSliderField PlayerFOV;

	public static BoolField PlayerFOVShouldUncap;

	public static EnumField<PerspectiveMode> Perspective;

	public static BoolField Stretch;

	public static FloatSliderField FisheyeFit;

	public static FloatSliderField StereoFactor;

	public static FloatSliderField PaniniFactor;

	public static FloatField Quality;

	public static KeyCodeField UltraFOVBind;

	public static BoolField Grid;

	public static KeyCodeField GridBind;

	public static FloatSliderField GridOpac;

	public static BoolField Map;

	public static KeyCodeField MapBind;

	public static FloatSliderField MapOpac;

	public static int perspectiveCount = 5;

	public static List<KeyCodeField> perspectiveBinds = new List<KeyCodeField>();

	public static List<ConfigField> configs = new List<ConfigField>();

	public static void Setup()
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		//IL_003f: Expected O, but got Unknown
		//IL_005a: 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: Expected O, but got Unknown
		//IL_006a: Expected O, but got Unknown
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Expected O, but got Unknown
		//IL_0095: Expected O, but got Unknown
		//IL_00b0: 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_00bb: Expected O, but got Unknown
		//IL_00c0: Expected O, but got Unknown
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Expected O, but got Unknown
		//IL_00ff: Expected O, but got Unknown
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Expected O, but got Unknown
		//IL_012a: Expected O, but got Unknown
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Expected O, but got Unknown
		//IL_0155: Expected O, but got Unknown
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Expected O, but got Unknown
		//IL_0194: Expected O, but got Unknown
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Expected O, but got Unknown
		//IL_01d5: Expected O, but got Unknown
		//IL_024a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0250: Expected O, but got Unknown
		//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02af: Expected O, but got Unknown
		//IL_02b4: Expected O, but got Unknown
		//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ee: Expected O, but got Unknown
		//IL_02f3: Expected O, but got Unknown
		//IL_0322: Unknown result type (might be due to invalid IL or missing references)
		//IL_0327: Unknown result type (might be due to invalid IL or missing references)
		//IL_032d: Expected O, but got Unknown
		//IL_0332: Expected O, but got Unknown
		//IL_0361: Unknown result type (might be due to invalid IL or missing references)
		//IL_0366: Unknown result type (might be due to invalid IL or missing references)
		//IL_036c: Expected O, but got Unknown
		//IL_0371: Expected O, but got Unknown
		//IL_039a: Unknown result type (might be due to invalid IL or missing references)
		//IL_039f: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a5: Expected O, but got Unknown
		//IL_03aa: Expected O, but got Unknown
		//IL_040b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0410: Unknown result type (might be due to invalid IL or missing references)
		//IL_0416: Expected O, but got Unknown
		//IL_0479: Unknown result type (might be due to invalid IL or missing references)
		//IL_047e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0484: Expected O, but got Unknown
		//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04da: Expected O, but got Unknown
		config = PluginConfigurator.Create("Eye of Providence", "ironfarm.uk.xbox369");
		List<ConfigField> list = configs;
		BoolField val = new BoolField(config.rootPanel, "Enable Mod", "bool.ultrafov", true);
		UltraFOV = val;
		list.Add((ConfigField)val);
		List<ConfigField> list2 = configs;
		KeyCodeField val2 = new KeyCodeField(config.rootPanel, "Activation Keybind", "keycode.ultrafov", (KeyCode)0);
		UltraFOVBind = val2;
		list2.Add((ConfigField)val2);
		List<ConfigField> list3 = configs;
		BoolField val3 = new BoolField(config.rootPanel, "Grid View", "bool.grid", false);
		Grid = val3;
		list3.Add((ConfigField)val3);
		List<ConfigField> list4 = configs;
		KeyCodeField val4 = new KeyCodeField(config.rootPanel, "Grid Keybind", "keycode.grid", (KeyCode)0);
		GridBind = val4;
		list4.Add((ConfigField)val4);
		List<ConfigField> list5 = configs;
		FloatSliderField val5 = new FloatSliderField(config.rootPanel, "Grid Opacity", "slider.gridopac", new Tuple<float, float>(0f, 1f), 0.2f, 2);
		GridOpac = val5;
		list5.Add((ConfigField)val5);
		List<ConfigField> list6 = configs;
		BoolField val6 = new BoolField(config.rootPanel, "Map View", "bool.map", false);
		Map = val6;
		list6.Add((ConfigField)val6);
		List<ConfigField> list7 = configs;
		KeyCodeField val7 = new KeyCodeField(config.rootPanel, "Map Keybind", "keycode.map", (KeyCode)0);
		MapBind = val7;
		list7.Add((ConfigField)val7);
		List<ConfigField> list8 = configs;
		FloatSliderField val8 = new FloatSliderField(config.rootPanel, "Map Opacity", "slider.mapopac", new Tuple<float, float>(0f, 1f), 0.75f, 2);
		MapOpac = val8;
		list8.Add((ConfigField)val8);
		List<ConfigField> list9 = configs;
		FloatSliderField val9 = new FloatSliderField(config.rootPanel, "Player Fov", "slider.playerfov", new Tuple<float, float>(0f, 360f), 360f, 0, true, true);
		PlayerFOV = val9;
		list9.Add((ConfigField)val9);
		configs.Add((ConfigField)(object)(Perspective = new EnumField<PerspectiveMode>(config.rootPanel, "Perspective", "enum.perspective", PerspectiveMode.Panini)));
		for (int i = 0; i < Enum.GetNames(typeof(PerspectiveMode)).Length; i++)
		{
			ConfigPanel rootPanel = config.rootPanel;
			PerspectiveMode perspectiveMode = (PerspectiveMode)i;
			string text = perspectiveMode.ToString() + " Keybind";
			perspectiveMode = (PerspectiveMode)i;
			KeyCodeField item = new KeyCodeField(rootPanel, text, "keycode.perspective." + perspectiveMode.ToString().ToLower(), (KeyCode)0);
			configs.Add((ConfigField)(object)item);
			perspectiveBinds.Add(item);
		}
		List<ConfigField> list10 = configs;
		BoolField val10 = new BoolField(config.rootPanel, "Stretch to View", "bool.stretch", false);
		Stretch = val10;
		list10.Add((ConfigField)val10);
		List<ConfigField> list11 = configs;
		FloatSliderField val11 = new FloatSliderField(config.rootPanel, "Fisheye Fit", "slider.fisheyefit", new Tuple<float, float>(0f, 2f), 0f, 2);
		FisheyeFit = val11;
		list11.Add((ConfigField)val11);
		List<ConfigField> list12 = configs;
		FloatSliderField val12 = new FloatSliderField(config.rootPanel, "Stereographic Scale", "slider.stereofactor", new Tuple<float, float>(0f, 3f), 0f, 2);
		StereoFactor = val12;
		list12.Add((ConfigField)val12);
		List<ConfigField> list13 = configs;
		FloatSliderField val13 = new FloatSliderField(config.rootPanel, "Panini Intensity", "slider.paninifactor", new Tuple<float, float>(0f, 1f), 1f, 2);
		PaniniFactor = val13;
		list13.Add((ConfigField)val13);
		List<ConfigField> list14 = configs;
		FloatField val14 = new FloatField(config.rootPanel, "Quality", "float.quality", 9f, 0f, 10f);
		Quality = val14;
		list14.Add((ConfigField)val14);
		for (int j = 0; j < configs.Count(); j++)
		{
			Type type = ((object)configs[j]).GetType();
			if (configs[j] is FloatSliderField)
			{
				ConfigField obj = configs[j];
				FloatSliderField val15 = (FloatSliderField)(object)((obj is FloatSliderField) ? obj : null);
				object obj2 = <>c.<>9__21_0;
				if (obj2 == null)
				{
					PostFloatSliderValueChangeEvent val16 = delegate
					{
						UpdateValeus();
					};
					<>c.<>9__21_0 = val16;
					obj2 = (object)val16;
				}
				val15.postValueChangeEvent += (PostFloatSliderValueChangeEvent)obj2;
				continue;
			}
			ConfigField val17 = configs[j];
			ConfigField val18 = val17;
			BoolField val19 = (BoolField)(object)((val18 is BoolField) ? val18 : null);
			if (val19 == null)
			{
				if (!(val18 is EnumField<PerspectiveMode> val20))
				{
					FloatField val21 = (FloatField)(object)((val18 is FloatField) ? val18 : null);
					if (val21 == null)
					{
						continue;
					}
					object obj3 = <>c.<>9__21_3;
					if (obj3 == null)
					{
						PostFloatValueChangeEvent val22 = delegate
						{
							UpdateValeus();
						};
						<>c.<>9__21_3 = val22;
						obj3 = (object)val22;
					}
					val21.postValueChangeEvent += (PostFloatValueChangeEvent)obj3;
				}
				else
				{
					val20.postValueChangeEvent += delegate
					{
						UpdateValeus();
					};
				}
				continue;
			}
			object obj4 = <>c.<>9__21_1;
			if (obj4 == null)
			{
				PostBoolValueChangeEvent val23 = delegate
				{
					UpdateValeus();
				};
				<>c.<>9__21_1 = val23;
				obj4 = (object)val23;
			}
			val19.postValueChangeEvent += (PostBoolValueChangeEvent)obj4;
		}
		UpdateValeus();
		string path = Utils.ModDir();
		string text2 = Path.Combine(Path.Combine(path, "Data"), "icon.png");
		config.SetIconWithURL("file://" + text2);
	}

	public static void Update()
	{
		//IL_0006: 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_006c: 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)
		if (Input.GetKeyUp(UltraFOVBind.value))
		{
			UltraFOV.value = !UltraFOV.value;
			UpdateValeus();
		}
		if (Input.GetKeyUp(MapBind.value))
		{
			Map.value = !Map.value;
			UpdateValeus();
		}
		if (Input.GetKeyUp(GridBind.value))
		{
			Grid.value = !Grid.value;
			UpdateValeus();
		}
		for (int i = 0; i < perspectiveBinds.Count(); i++)
		{
			if (Input.GetKeyUp(perspectiveBinds[i].value))
			{
				Perspective.value = (PerspectiveMode)i;
				UpdateValeus();
			}
		}
	}

	public static void UpdateValeus()
	{
		Plugin.UltraFOV = UltraFOV.value;
		PostProssesingBaby.Grid = Grid.value;
		PostProssesingBaby.GridOpac = GridOpac.value;
		PostProssesingBaby.Map = Map.value;
		PostProssesingBaby.MapOpac = MapOpac.value;
		PostProssesingBaby.PlayerFOV = PlayerFOV.value;
		PostProssesingBaby.Perspective = Perspective.value;
		PostProssesingBaby.Quality = Quality.value;
		PostProssesingBaby.FisheyeFit = FisheyeFit.value;
		PostProssesingBaby.Stretch = Stretch.value;
		PostProssesingBaby.StereoFactor = StereoFactor.value;
		PostProssesingBaby.PaniniFactor = PaniniFactor.value;
		for (int i = 0; i < configs.Count(); i++)
		{
			if (configs[i].guid != "bool.ultrafov")
			{
				configs[i].hidden = true;
			}
		}
		if (UltraFOV.value)
		{
			((ConfigField)UltraFOVBind).hidden = false;
			((ConfigField)Grid).hidden = false;
			((ConfigField)Map).hidden = false;
			((ConfigField)PlayerFOV).hidden = false;
			((ConfigField)Perspective).hidden = false;
			((ConfigField)Quality).hidden = false;
			((ConfigField)Stretch).hidden = false;
			if (Grid.value)
			{
				((ConfigField)GridOpac).hidden = false;
				((ConfigField)GridBind).hidden = false;
			}
			if (Map.value)
			{
				((ConfigField)MapOpac).hidden = false;
				((ConfigField)MapBind).hidden = false;
			}
			switch (Perspective.value)
			{
			case PerspectiveMode.Fisheye:
				((ConfigField)FisheyeFit).hidden = false;
				break;
			case PerspectiveMode.Stereographic:
				((ConfigField)PlayerFOV).hidden = true;
				((ConfigField)StereoFactor).hidden = false;
				break;
			case PerspectiveMode.Panini:
				((ConfigField)PlayerFOV).hidden = true;
				((ConfigField)PaniniFactor).hidden = false;
				break;
			}
			((ConfigField)perspectiveBinds[(int)Perspective.value]).hidden = false;
		}
	}
}
[BepInPlugin("ironfarm.uk.xbox369", "Eye of Providence", "0.2.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch]
	public static class XboxGamePass
	{
		public static bool reinitTex = UltraFOV;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PostProcessV2_Handler), "OnPreRenderCallback")]
		public static void FUUUUUUUU(PostProcessV2_Handler __instance)
		{
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PostProcessV2_Handler), "HeatWaves")]
		public static void skinitsundermyskinoffpeelitoffskinoffpeeloffskin(PostProcessV2_Handler __instance)
		{
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PostProcessV2_Handler), "ReleaseTextures")]
		public static void DisbandTrollLegion(PostProcessV2_Handler __instance)
		{
			if (Object.op_Implicit((Object)(object)tex))
			{
				tex.Release();
			}
			if (Object.op_Implicit((Object)(object)tex))
			{
				Object.Destroy((Object)(object)tex);
			}
			tex = null;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PostProcessV2_Handler), "ChangeCamera")]
		public static void remember(PostProcessV2_Handler __instance)
		{
			if (UltraFOV)
			{
				reinitTex = true;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PostProcessV2_Handler), "SetupRTs")]
		public static void rage(PostProcessV2_Handler __instance)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)tex))
			{
			}
			if (Object.op_Implicit((Object)(object)tex))
			{
			}
			bool flag = __instance.width != __instance.lastWidth || __instance.height != __instance.lastHeight;
			if (reinitTex || flag)
			{
				tex = new RenderTexture(__instance.width, __instance.height, 0, (RenderTextureFormat)0)
				{
					name = "Xx_TrollLegion_xX",
					antiAliasing = 1,
					filterMode = (FilterMode)0
				};
				__instance.mainTex = tex;
				__instance.buffers[0] = __instance.mainTex.colorBuffer;
				__instance.buffers[1] = __instance.reusableBufferA.colorBuffer;
				__instance.buffers[2] = __instance.viewNormal.colorBuffer;
				__instance.SetupOutlines(false);
				__instance.hudCam.SetTargetBuffers(__instance.mainTex.colorBuffer, __instance.depthBuffer.depthBuffer);
				__instance.postProcessV2_VSRM.SetTexture("_MainTex", (Texture)(object)__instance.mainTex);
				reinitTex = false;
			}
		}
	}

	private Harmony harmony = new Harmony("ironfarm.uk.xbox369");

	private AssetBundle bundle;

	private GameObject globePref;

	private Camera[] cams = (Camera[])(object)new Camera[6];

	private static GameObject globe;

	public static PostProssesingBaby post;

	private Material mat;

	private RenderBuffer[] chumBuckets = (RenderBuffer[])(object)new RenderBuffer[3];

	private static RenderTexture tex;

	private static RenderTexture tempTex;

	private static RenderTexture tex2;

	private static Texture texst;

	public static bool UltraFOV = true;

	public CommandBuffer bloodOilCB;

	public void Awake()
	{
	}

	public void Start()
	{
		Debug.Log((object)"Reddit, I think I know what we're gonna do today!");
		AssetHandler.LoadBundle("ultra_nato");
		globePref = AssetHandler.LoadAsset<GameObject>("GlobeCam");
		mat = AssetHandler.LoadAsset<Material>("coolMat");
		harmony.PatchAll(typeof(XboxGamePass));
		ConfigManager.Setup();
	}

	public void Update()
	{
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		if (UltraFOV)
		{
			if (Object.op_Implicit((Object)(object)MonoSingleton<CameraController>.Instance) && Object.op_Implicit((Object)(object)MonoSingleton<CameraController>.Instance.cam) && !Object.op_Implicit((Object)(object)globe))
			{
				SetupGlobe();
			}
		}
		else if (Object.op_Implicit((Object)(object)globe))
		{
			if (Object.op_Implicit((Object)(object)MonoSingleton<CameraController>.Instance.cam.targetTexture))
			{
			}
			ClearGlobe();
		}
		if (Object.op_Implicit((Object)(object)globe))
		{
			globe.transform.position = ((Component)MonoSingleton<CameraController>.Instance).gameObject.transform.position;
			globe.transform.rotation = ((Component)MonoSingleton<CameraController>.Instance).gameObject.transform.rotation;
			if (Object.op_Implicit((Object)(object)tex) && (Object)(object)post.mainCam.targetTexture != (Object)(object)tex)
			{
				post.mainCam.targetTexture = tex;
			}
		}
		ConfigManager.Update();
	}

	public void SetupGlobe()
	{
		//IL_002d: 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)
		XboxGamePass.reinitTex = true;
		MonoSingleton<PostProcessV2_Handler>.Instance.reinitializeTextures = true;
		MonoSingleton<PostProcessV2_Handler>.Instance.SetupRTs();
		globe = Object.Instantiate<GameObject>(globePref, ((Component)MonoSingleton<NewMovement>.instance).transform.position, Quaternion.identity);
		for (int i = 0; i < cams.Length; i++)
		{
			cams[i] = ((Component)globe.transform.GetChild(i)).GetComponent<Camera>();
			cams[i].nearClipPlane = MonoSingleton<CameraController>.Instance.cam.nearClipPlane;
			cams[i].farClipPlane = MonoSingleton<CameraController>.Instance.cam.farClipPlane;
			cams[i].cullingMask = MonoSingleton<CameraController>.Instance.cam.cullingMask;
		}
		post = ((Component)((Component)MonoSingleton<CameraController>.Instance.cam).transform).gameObject.AddComponent<PostProssesingBaby>();
		post.mainCam = ((Component)post).GetComponent<Camera>();
		post.mainCam.targetTexture = tex;
		post.postEffectMaterial = mat;
		post.cams = cams;
	}

	public void ClearGlobe()
	{
		if (Object.op_Implicit((Object)(object)globe))
		{
			Object.Destroy((Object)(object)globe);
		}
		globe = null;
		for (int i = 0; i < cams.Length; i++)
		{
			cams[i] = null;
		}
		post.mainCam.targetTexture = MonoSingleton<PostProcessV2_Handler>.Instance.mainTex;
		XboxGamePass.reinitTex = false;
		MonoSingleton<PostProcessV2_Handler>.Instance.reinitializeTextures = true;
		MonoSingleton<PostProcessV2_Handler>.Instance.SetupRTs();
		PostProssesingBaby postProssesingBaby = default(PostProssesingBaby);
		if (((Component)MonoSingleton<CameraController>.Instance).gameObject.TryGetComponent<PostProssesingBaby>(ref postProssesingBaby))
		{
			Object.Destroy((Object)(object)postProssesingBaby);
		}
	}
}
internal class PluginInfo
{
	public const string Name = "Eye of Providence";

	public const string Version = "0.2.0";

	public const string GUID = "ironfarm.uk.xbox369";
}
public class PostProssesingBaby : MonoBehaviour
{
	private enum CameraFace
	{
		Front,
		Back,
		Left,
		Right,
		Up,
		Down
	}

	public static float PlayerFOV = 360f;

	public static PerspectiveMode Perspective = PerspectiveMode.Equirectangular;

	public static float Quality = 9f;

	public static bool Debug = false;

	public static bool Grid = false;

	public static float GridOpac = 0f;

	public static bool Map = false;

	public static float MapOpac = 0f;

	public static bool Stretch = true;

	public static float StereoFactor = 0f;

	public static float FisheyeFit = 0f;

	public static float PaniniFactor = 1f;

	public Camera mainCam;

	private Shader postShader;

	public Material postEffectMaterial;

	public Camera[] cams;

	private List<RenderTexture> camTexs = new List<RenderTexture>();

	public float quality = 9f;

	public bool debugMode = false;

	public bool mapMode = false;

	public float mapOpac = 0.5f;

	public bool gridMode = false;

	public float gridOpac = 0.5f;

	public bool stretch = true;

	public float fisheyeFit = 0f;

	public float stereoFactor = 0f;

	public float paniniFactor = 1f;

	public float fov = 360f;

	public int mode = 0;

	private float prevQuality;

	private int qualityPixel = 1;

	public float aspect = 1f;

	public float prevAspect = 1f;

	private float width = 2f;

	private float height = 1f;

	private float prevWidth = 0f;

	private float prevHeight = 0f;

	public FilterMode filterMode = (FilterMode)0;

	private void Start()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		mainCam = ((Component)this).GetComponent<Camera>();
		mainCam.depthTextureMode = (DepthTextureMode)(mainCam.depthTextureMode | 2);
		quality = Quality;
		qualityPixel = (int)Mathf.Pow(2f, quality);
		prevQuality = quality;
		fov = PlayerFOV;
		mode = (int)Perspective;
		stretch = Stretch;
		debugMode = Debug;
		gridOpac = GridOpac;
		mapOpac = MapOpac;
		fisheyeFit = FisheyeFit;
		paniniFactor = PaniniFactor;
		postEffectMaterial.SetFloat("_FOV", fov);
		postEffectMaterial.SetFloat("_MODE", (float)mode);
		postEffectMaterial.SetFloat("_STRETCH", stretch ? 1f : 0f);
		postEffectMaterial.SetFloat("_ASPECT", (!stretch) ? ((float)Screen.width / (float)Screen.height) : 1f);
		postEffectMaterial.SetFloat("_FISHEYE_STEREO_FACTOR", stereoFactor);
		postEffectMaterial.SetFloat("_FISHEYE_FIT", fisheyeFit);
		postEffectMaterial.SetFloat("_PANINI_FACTOR", paniniFactor);
		postEffectMaterial.SetFloat("_DEBUG", (float)(debugMode ? 1 : 0));
		postEffectMaterial.SetFloat("_GRID", (float)(gridMode ? 1 : 0));
		postEffectMaterial.SetFloat("_MAP", (float)(mapMode ? 1 : 0));
		postEffectMaterial.SetFloat("_GRID_FACTOR", gridOpac);
		postEffectMaterial.SetFloat("_MAP_FACTOR", mapOpac);
		RefreshRenderTextures();
	}

	private void Update()
	{
		if (PlayerFOV != fov)
		{
			fov = PlayerFOV;
			postEffectMaterial.SetFloat("_FOV", fov);
		}
		quality = Quality;
		if (quality != prevQuality)
		{
			quality = Mathf.Clamp(quality, 0f, 10f);
			prevQuality = quality;
			qualityPixel = (int)Mathf.Pow(2f, quality);
			RefreshRenderTextures();
		}
		if (debugMode != Debug)
		{
			debugMode = Debug;
			postEffectMaterial.SetFloat("_DEBUG", (float)(debugMode ? 1 : 0));
		}
		if (gridMode != Grid)
		{
			gridMode = Grid;
			postEffectMaterial.SetFloat("_GRID", (float)(gridMode ? 1 : 0));
		}
		if (gridOpac != GridOpac)
		{
			gridOpac = GridOpac;
			postEffectMaterial.SetFloat("_GRID_FACTOR", gridOpac);
		}
		if (mapMode != Map)
		{
			mapMode = Map;
			postEffectMaterial.SetFloat("_MAP", (float)(mapMode ? 1 : 0));
		}
		if (mapOpac != MapOpac)
		{
			mapOpac = MapOpac;
			postEffectMaterial.SetFloat("_MAP_FACTOR", mapOpac);
		}
		if (stereoFactor != StereoFactor)
		{
			stereoFactor = StereoFactor;
			postEffectMaterial.SetFloat("_FISHEYE_STEREO_FACTOR", stereoFactor);
		}
		if (FisheyeFit != fisheyeFit)
		{
			fisheyeFit = FisheyeFit;
			postEffectMaterial.SetFloat("_FISHEYE_FIT", fisheyeFit);
		}
		if (paniniFactor != PaniniFactor)
		{
			paniniFactor = PaniniFactor;
			postEffectMaterial.SetFloat("_PANINI_FACTOR", paniniFactor);
		}
		if (stretch != Stretch)
		{
			stretch = Stretch;
			width = Screen.width;
			height = Screen.height;
			aspect = (stretch ? 1f : ((float)Screen.width / (float)Screen.height));
			postEffectMaterial.SetFloat("_STRETCH", stretch ? 1f : 0f);
			postEffectMaterial.SetFloat("_ASPECT", aspect);
			prevWidth = width;
			prevHeight = height;
		}
		if (mode == (int)Perspective)
		{
			return;
		}
		mode = (int)Perspective;
		postEffectMaterial.SetFloat("_MODE", (float)mode);
		width = Screen.width;
		height = Screen.height;
		prevWidth = width;
		prevHeight = height;
		if (mode == 4)
		{
			if ((Object)(object)cams[1] != (Object)null)
			{
				((Component)cams[1]).gameObject.SetActive(false);
			}
		}
		else if ((Object)(object)cams[1] != (Object)null)
		{
			((Component)cams[1]).gameObject.SetActive(true);
		}
		RefreshRenderTextures();
	}

	public void RefreshFOV()
	{
	}

	public void RefreshRenderTextures()
	{
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Expected O, but got Unknown
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < cams.Length; i++)
		{
			if (Object.op_Implicit((Object)(object)cams[i]))
			{
				if ((Object)(object)cams[i].targetTexture != (Object)null)
				{
					cams[i].targetTexture.Release();
				}
				RenderTexture val = new RenderTexture(qualityPixel, qualityPixel, 24);
				((Texture)val).filterMode = filterMode;
				cams[i].targetTexture = val;
			}
		}
	}

	private void OnRenderImage(RenderTexture src, RenderTexture dest)
	{
		//IL_0007: 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)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		Matrix4x4 cameraToWorldMatrix = mainCam.cameraToWorldMatrix;
		postEffectMaterial.SetMatrix("_viewToWorld", cameraToWorldMatrix);
		postEffectMaterial.SetTexture("_Cam_Front", (Texture)(object)cams[0].targetTexture);
		postEffectMaterial.SetTexture("_Cam_Back", (Texture)(object)cams[1].targetTexture);
		postEffectMaterial.SetTexture("_Cam_Left", (Texture)(object)cams[2].targetTexture);
		postEffectMaterial.SetTexture("_Cam_Right", (Texture)(object)cams[3].targetTexture);
		postEffectMaterial.SetTexture("_Cam_Up", (Texture)(object)cams[4].targetTexture);
		postEffectMaterial.SetTexture("_Cam_Down", (Texture)(object)cams[5].targetTexture);
		Graphics.Blit((Texture)(object)src, dest, postEffectMaterial);
	}
}
public static class Utils
{
	public const float TIMESTEP_BANDAGE = 60f;

	private static List<GameObject> descendants = new List<GameObject>();

	private static int descendantDepth = 0;

	public static string ModDir()
	{
		return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
	}

	public static string ModDataDir()
	{
		return Path.Combine(ModDir(), "Data");
	}

	public static Vector3 RandPos(float x, float y, float z)
	{
		//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)
		return new Vector3(Random.Range(0f - x, x), Random.Range(0f - y, y), Random.Range(0f - z, z));
	}

	public static Vector3 RandPos(float x, float y)
	{
		//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)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		return new Vector3(Random.Range(0f - x, x), Random.Range(0f - y, y), 0f);
	}

	public static Vector3 Uniform(float num)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: 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)
		return new Vector3(num, num, num);
	}

	public static Vector3 Scale(float num)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: 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)
		return new Vector3(num, num, num);
	}

	public static float Sin01(float x)
	{
		return (Mathf.Sin(x) + 1f) * 0.5f;
	}

	public static float Normalize(float num, bool oneDefault = true)
	{
		if (num == 0f)
		{
			if (oneDefault)
			{
				return 1f;
			}
			return 0f;
		}
		return num / Mathf.Abs(num);
	}

	public static float DirToAngle(Vector3 dir)
	{
		//IL_0001: 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)
		return Mathf.Atan2(dir.y, dir.x) * 57.29578f;
	}

	public static float UpDirToAngle(Vector3 dir)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//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)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: 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)
		dir = Quaternion.AngleAxis(-90f, Vector3.forward) * dir;
		return Mathf.Atan2(dir.y, dir.x) * 57.29578f;
	}

	public static float AngleRelToDir(Vector3 dir, Vector3 relDir)
	{
		//IL_0001: 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_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: 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_0020: Unknown result type (might be due to invalid IL or missing references)
		dir = Quaternion.AngleAxis(0f - DirToAngle(relDir), Vector3.forward) * dir;
		return Mathf.Atan2(dir.y, dir.x) * 57.29578f;
	}

	public static float AngleRelToDir(Vector3 dir, float angle)
	{
		//IL_0002: 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_000c: 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_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		dir = Quaternion.AngleAxis(angle, Vector3.forward) * dir;
		return Mathf.Atan2(dir.y, dir.x) * 57.29578f;
	}

	public static Vector3 AngleToDir(float angle)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_001f: Unknown result type (might be due to invalid IL or missing references)
		return Quaternion.Euler(0f, 0f, 0f - angle) * Vector3.right;
	}

	public static Vector3 UpAngleToDir(float angle)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//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)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		return Quaternion.Euler(0f, 0f, angle) * Vector3.up;
	}

	public static void SetTimelineBinding(PlayableDirector pd, int index, Object obj)
	{
		? val = pd;
		PlayableAsset playableAsset = pd.playableAsset;
		((PlayableDirector)val).SetGenericBinding((Object)(object)((TimelineAsset)((playableAsset is TimelineAsset) ? playableAsset : null)).GetOutputTrack(index), obj);
	}

	public static string GetTransformPath(Transform transform)
	{
		List<string> list = new List<string>();
		Transform val = transform;
		while ((Object)(object)val != (Object)null)
		{
			list.Add(((Object)val).name);
			val = val.parent;
		}
		string text = "";
		for (int num = list.Count() - 1; num >= 0; num--)
		{
			text += list[num];
			if (num != 0)
			{
				text += "/";
			}
		}
		return text;
	}

	private static void GatherDescendants(this GameObject from)
	{
		for (int i = 0; i < from.transform.childCount; i++)
		{
			((Component)from.transform.GetChild(i)).gameObject.GatherDescendants();
			descendants.Add(((Component)from.transform.GetChild(i)).gameObject);
		}
	}

	public static List<GameObject> DescendantsList(this GameObject from)
	{
		if (descendants.Count > 0)
		{
			descendants.Clear();
		}
		from.GatherDescendants();
		return descendants;
	}

	public static GameObject DescendantByName(this GameObject from, string name)
	{
		if (from.transform.childCount > 0)
		{
			for (int i = 0; i < from.transform.childCount; i++)
			{
				GameObject gameObject = ((Component)from.transform.GetChild(i)).gameObject;
				if (((Object)gameObject).name == name)
				{
					return gameObject;
				}
				descendantDepth++;
				GameObject val = gameObject.DescendantByName(name);
				descendantDepth--;
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
			}
		}
		if (descendantDepth == 0)
		{
			Debug.Log((object)("No child with name " + name + " found in " + ((Object)from).name));
		}
		return null;
	}
}