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.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("UltraFOV")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UltraFOV")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8119beb0-07d8-4fae-b2a6-26aec8486a29")]
[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 UltraFOV;
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
}
public static class ConfigManager
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static PostFloatSliderValueChangeEvent <>9__13_0;
public static PostEnumValueChangeEvent<PerspectiveMode> <>9__13_1;
public static PostFloatValueChangeEvent <>9__13_2;
public static PostBoolValueChangeEvent <>9__13_3;
public static PostBoolValueChangeEvent <>9__13_4;
public static PostBoolValueChangeEvent <>9__13_5;
public static PostFloatSliderValueChangeEvent <>9__13_6;
public static PostFloatSliderValueChangeEvent <>9__13_7;
public static PostBoolValueChangeEvent <>9__13_8;
internal void <Setup>b__13_0(float e, Tuple<float, float> f)
{
UpdateValeus();
}
internal void <Setup>b__13_1(PerspectiveMode e)
{
UpdateValeus();
}
internal void <Setup>b__13_2(float e)
{
UpdateValeus();
}
internal void <Setup>b__13_3(bool e)
{
UpdateValeus();
}
internal void <Setup>b__13_4(bool e)
{
UpdateValeus();
}
internal void <Setup>b__13_5(bool e)
{
UpdateValeus();
}
internal void <Setup>b__13_6(float e, Tuple<float, float> f)
{
UpdateValeus();
}
internal void <Setup>b__13_7(float e, Tuple<float, float> f)
{
UpdateValeus();
}
internal void <Setup>b__13_8(bool 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 EquirectStretch;
public static FloatSliderField FisheyeFit;
public static BoolField FisheyeStretch;
public static FloatField Quality;
public static KeyCodeField UltraFOVBind;
public static BoolField Debug;
public static KeyCodeField DebugBind;
public static void Setup()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Expected O, but got Unknown
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Expected O, but got Unknown
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Expected O, but got Unknown
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Expected O, but got Unknown
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Expected O, but got Unknown
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Expected O, but got Unknown
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Expected O, but got Unknown
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Expected O, but got Unknown
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Expected O, but got Unknown
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_026d: Unknown result type (might be due to invalid IL or missing references)
//IL_0273: Expected O, but got Unknown
//IL_0291: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Expected O, but got Unknown
//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02c5: 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
config = PluginConfigurator.Create("UltraFOV", "ironfarm.uk.xbox360");
UltraFOV = new BoolField(config.rootPanel, "Enable FOV", "bool.ultrafov", true);
UltraFOVBind = new KeyCodeField(config.rootPanel, "FOV Keybind", "keycode.ultrafov", (KeyCode)0);
Debug = new BoolField(config.rootPanel, "Debug View", "bool.debug", false);
DebugBind = new KeyCodeField(config.rootPanel, "Debug Keybind", "keycode.debug", (KeyCode)0);
PlayerFOV = new FloatSliderField(config.rootPanel, "Player Fov", "slider.playerfov", new Tuple<float, float>(0f, 360f), 360f, 0, true, true);
Perspective = new EnumField<PerspectiveMode>(config.rootPanel, "Perspective", "enum.perspective", PerspectiveMode.Equirectangular);
EquirectStretch = new BoolField(config.rootPanel, "Stretch to View", "bool.equirectstretch", true);
FisheyeFit = new FloatSliderField(config.rootPanel, "Fisheye Fit", "slider.fisheyefit", new Tuple<float, float>(0f, 1f), 0f, 2);
FisheyeStretch = new BoolField(config.rootPanel, "Stretch to View", "bool.fisheyestretch", true);
Quality = new FloatField(config.rootPanel, "Quality", "float.quality", 9f, 0f, 10f);
FloatSliderField playerFOV = PlayerFOV;
object obj = <>c.<>9__13_0;
if (obj == null)
{
PostFloatSliderValueChangeEvent val = delegate
{
UpdateValeus();
};
<>c.<>9__13_0 = val;
obj = (object)val;
}
playerFOV.postValueChangeEvent += (PostFloatSliderValueChangeEvent)obj;
Perspective.postValueChangeEvent += delegate
{
UpdateValeus();
};
FloatField quality = Quality;
object obj2 = <>c.<>9__13_2;
if (obj2 == null)
{
PostFloatValueChangeEvent val2 = delegate
{
UpdateValeus();
};
<>c.<>9__13_2 = val2;
obj2 = (object)val2;
}
quality.postValueChangeEvent += (PostFloatValueChangeEvent)obj2;
BoolField ultraFOV = UltraFOV;
object obj3 = <>c.<>9__13_3;
if (obj3 == null)
{
PostBoolValueChangeEvent val3 = delegate
{
UpdateValeus();
};
<>c.<>9__13_3 = val3;
obj3 = (object)val3;
}
ultraFOV.postValueChangeEvent += (PostBoolValueChangeEvent)obj3;
BoolField debug = Debug;
object obj4 = <>c.<>9__13_4;
if (obj4 == null)
{
PostBoolValueChangeEvent val4 = delegate
{
UpdateValeus();
};
<>c.<>9__13_4 = val4;
obj4 = (object)val4;
}
debug.postValueChangeEvent += (PostBoolValueChangeEvent)obj4;
BoolField equirectStretch = EquirectStretch;
object obj5 = <>c.<>9__13_5;
if (obj5 == null)
{
PostBoolValueChangeEvent val5 = delegate
{
UpdateValeus();
};
<>c.<>9__13_5 = val5;
obj5 = (object)val5;
}
equirectStretch.postValueChangeEvent += (PostBoolValueChangeEvent)obj5;
FloatSliderField fisheyeFit = FisheyeFit;
object obj6 = <>c.<>9__13_6;
if (obj6 == null)
{
PostFloatSliderValueChangeEvent val6 = delegate
{
UpdateValeus();
};
<>c.<>9__13_6 = val6;
obj6 = (object)val6;
}
fisheyeFit.postValueChangeEvent += (PostFloatSliderValueChangeEvent)obj6;
FloatSliderField fisheyeFit2 = FisheyeFit;
object obj7 = <>c.<>9__13_7;
if (obj7 == null)
{
PostFloatSliderValueChangeEvent val7 = delegate
{
UpdateValeus();
};
<>c.<>9__13_7 = val7;
obj7 = (object)val7;
}
fisheyeFit2.postValueChangeEvent += (PostFloatSliderValueChangeEvent)obj7;
BoolField fisheyeStretch = FisheyeStretch;
object obj8 = <>c.<>9__13_8;
if (obj8 == null)
{
PostBoolValueChangeEvent val8 = delegate
{
UpdateValeus();
};
<>c.<>9__13_8 = val8;
obj8 = (object)val8;
}
fisheyeStretch.postValueChangeEvent += (PostBoolValueChangeEvent)obj8;
UpdateValeus();
string text = Path.Combine(Path.Combine(Utils.ModDir(), "Data"), "icon.png");
config.SetIconWithURL("file://" + text);
}
public static void Update()
{
//IL_0005: 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)
if (Input.GetKeyDown(UltraFOVBind.value))
{
UltraFOV.value = !UltraFOV.value;
UpdateValeus();
}
if (Input.GetKeyDown(DebugBind.value))
{
Debug.value = !Debug.value;
UpdateValeus();
}
}
public static void UpdateValeus()
{
Plugin.UltraFOV = UltraFOV.value;
PostProssesingBaby.Debug = Debug.value;
PostProssesingBaby.PlayerFOV = PlayerFOV.value;
PostProssesingBaby.Perspective = Perspective.value;
PostProssesingBaby.Quality = Quality.value;
PostProssesingBaby.FisheyeFit = FisheyeFit.value;
PostProssesingBaby.FisheyeStretch = FisheyeStretch.value;
PostProssesingBaby.EquirectStretch = EquirectStretch.value;
((ConfigField)PlayerFOV).hidden = true;
((ConfigField)Perspective).hidden = true;
((ConfigField)Quality).hidden = true;
((ConfigField)DebugBind).hidden = true;
((ConfigField)UltraFOVBind).hidden = true;
((ConfigField)Debug).hidden = true;
((ConfigField)FisheyeFit).hidden = true;
((ConfigField)FisheyeStretch).hidden = true;
((ConfigField)EquirectStretch).hidden = true;
if (UltraFOV.value)
{
((ConfigField)DebugBind).hidden = false;
((ConfigField)UltraFOVBind).hidden = false;
((ConfigField)Debug).hidden = false;
((ConfigField)PlayerFOV).hidden = false;
((ConfigField)Perspective).hidden = false;
((ConfigField)Quality).hidden = false;
switch (Perspective.value)
{
case PerspectiveMode.Equirectangular:
((ConfigField)EquirectStretch).hidden = false;
break;
case PerspectiveMode.Fisheye:
((ConfigField)FisheyeFit).hidden = false;
((ConfigField)FisheyeStretch).hidden = false;
break;
}
}
}
}
[BepInPlugin("ironfarm.uk.xbox360", "UltraFOV", "0.1.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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: 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)
//IL_0076: Expected O, but got Unknown
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: 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_00bc: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
Object.op_Implicit((Object)(object)tex);
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.xbox360");
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_0087: 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 (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))
{
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_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: 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 = "UltraFOV";
public const string Version = "0.1.0";
public const string GUID = "ironfarm.uk.xbox360";
}
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 float FisheyeFit = 0f;
public static bool FisheyeStretch = true;
public static bool EquirectStretch = true;
public static bool Debug = false;
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;
public float fisheyeMode;
public float fisheyeFit;
public bool equirectStretch = true;
public bool fisheyeStretch = true;
public float fov = 360f;
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;
private float prevHeight;
public FilterMode filterMode;
private void Start()
{
//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)
mainCam = ((Component)this).GetComponent<Camera>();
mainCam.depthTextureMode = (DepthTextureMode)(mainCam.depthTextureMode | 2);
quality = Quality;
qualityPixel = (int)Mathf.Pow(2f, quality);
prevQuality = quality;
fov = PlayerFOV;
fisheyeMode = ((Perspective == PerspectiveMode.Fisheye) ? 1 : 0);
equirectStretch = EquirectStretch;
fisheyeStretch = FisheyeStretch;
debugMode = Debug;
postEffectMaterial.SetFloat("_FOV", fov);
postEffectMaterial.SetFloat("_FISHEYE", fisheyeMode);
postEffectMaterial.SetFloat("_EQUIRECT_STRETCH", equirectStretch ? 1f : 0f);
postEffectMaterial.SetFloat("_ASPECT", ((!fisheyeStretch && Perspective == PerspectiveMode.Fisheye) || (!equirectStretch && Perspective == PerspectiveMode.Equirectangular)) ? ((float)Screen.width / (float)Screen.height) : 1f);
postEffectMaterial.SetFloat("_DEBUG", (float)(debugMode ? 1 : 0));
RefreshRenderTextures();
}
private void Update()
{
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
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();
}
for (int i = 0; i < cams.Length; i++)
{
((Texture)cams[i].targetTexture).filterMode = filterMode;
}
if (debugMode != Debug)
{
debugMode = Debug;
postEffectMaterial.SetFloat("_DEBUG", (float)(debugMode ? 1 : 0));
}
if (FisheyeFit != fisheyeFit)
{
fisheyeFit = FisheyeFit;
postEffectMaterial.SetFloat("_FISHEYE_FIT", fisheyeFit);
}
if (FisheyeStretch != fisheyeStretch)
{
fisheyeStretch = FisheyeStretch;
width = Screen.width;
height = Screen.height;
aspect = (fisheyeStretch ? 1f : ((float)Screen.width / (float)Screen.height));
postEffectMaterial.SetFloat("_ASPECT", aspect);
prevWidth = width;
prevHeight = height;
}
if (EquirectStretch != equirectStretch)
{
equirectStretch = EquirectStretch;
width = Screen.width;
height = Screen.height;
aspect = (equirectStretch ? 1f : ((float)Screen.width / (float)Screen.height));
postEffectMaterial.SetFloat("_EQUIRECT_STRETCH", equirectStretch ? 1f : 0f);
postEffectMaterial.SetFloat("_ASPECT", aspect);
prevWidth = width;
prevHeight = height;
}
if ((!fisheyeStretch && Perspective == PerspectiveMode.Fisheye) || (!equirectStretch && Perspective == PerspectiveMode.Equirectangular))
{
width = Screen.width;
height = Screen.height;
if (prevWidth != width || prevHeight != height)
{
aspect = (float)Screen.width / (float)Screen.height;
postEffectMaterial.SetFloat("_ASPECT", aspect);
prevWidth = width;
prevHeight = height;
}
}
if ((Perspective == PerspectiveMode.Fisheye && fisheyeMode <= 0.5f) || (Perspective != PerspectiveMode.Fisheye && fisheyeMode >= 0.5f))
{
fisheyeMode = ((Perspective == PerspectiveMode.Fisheye) ? 1 : 0);
postEffectMaterial.SetFloat("_FISHEYE", fisheyeMode);
width = Screen.width;
height = Screen.height;
aspect = (((!fisheyeStretch && Perspective == PerspectiveMode.Fisheye) || (!equirectStretch && Perspective == PerspectiveMode.Equirectangular)) ? ((float)Screen.width / (float)Screen.height) : 1f);
postEffectMaterial.SetFloat("_ASPECT", aspect);
prevWidth = width;
prevHeight = height;
RefreshRenderTextures();
}
}
public void RefreshFOV()
{
}
public void RefreshRenderTextures()
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_0050: 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_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_0017: 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_0018: 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_0015: 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_0003: 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_0003: 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_0000: 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)
return Mathf.Atan2(dir.y, dir.x) * 57.29578f;
}
public static float UpDirToAngle(Vector3 dir)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_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_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0000: 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_0011: 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_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)
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_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_000b: 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_0011: 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_0019: 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_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)
return Quaternion.Euler(0f, 0f, 0f - angle) * Vector3.right;
}
public static Vector3 UpAngleToDir(float angle)
{
//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_0015: 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;
}
}