Decompiled source of CinematicRendererMod v1.2.1

CinematicRendererMod/CinematicRendererMod.dll

Decompiled a year ago
using System;
using System.CodeDom.Compiler;
using System.Configuration;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Game;
using Game.Common;
using HarmonyLib;
using LemmyModFramework;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.5", FrameworkDisplayName = ".NET Framework 4.5")]
[assembly: AssemblyCompany("CinematicRendererMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CinematicRendererMod")]
[assembly: AssemblyTitle("CinematicRendererMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LemmyMod_Mono
{
	[BepInPlugin("CinematicRendererMod", "CinematicRendererMod", "1.1.0")]
	public class CinematicRendererModPlugin : BaseUnityPlugin
	{
		public const string GUID = "CinematicRendererMod";

		private void Awake()
		{
			//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_001b: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			Logger.LogSource = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("LemmyMod");
			Patcher.Init(val);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"CinematicRendererModPlugin LemmyMod is loaded!");
			MethodInfo method = typeof(CinematicRendererModPlugin).GetMethod("InjectSystems", BindingFlags.Static | BindingFlags.Public);
			MethodInfo method2 = typeof(SystemOrder).GetMethod("Initialize", BindingFlags.Static | BindingFlags.Public);
			val.Patch((MethodBase)method2, (HarmonyMethod)null, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null);
		}

		private void UiUpdate()
		{
		}

		private void LogHandler(string message, LogType type)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			if ((int)type == 0)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)message);
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)message);
			}
		}

		public static void InjectSystems(UpdateSystem updateSystem)
		{
			Patcher.InjectSystems(updateSystem);
		}

		private void OnInitialized()
		{
		}
	}
}
namespace LemmyMod_Mono.Properties
{
	[CompilerGenerated]
	[GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.8.0.0")]
	internal sealed class Settings : ApplicationSettingsBase
	{
		private static Settings defaultInstance = (Settings)(object)SettingsBase.Synchronized((SettingsBase)(object)new Settings());

		public static Settings Default => defaultInstance;
	}
}

CinematicRendererMod/CinematicRendererMod_Framework.dll

Decompiled a year ago
using System;
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.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using System.Xml;
using BepInEx.Logging;
using Cinemachine;
using Colossal;
using Colossal.IO.AssetDatabase;
using Colossal.IO.AssetDatabase.VirtualTexturing;
using Game;
using Game.CinematicCamera;
using Game.Rendering;
using Game.Rendering.CinematicCamera;
using Game.Rendering.Utilities;
using Game.SceneFlow;
using Game.Settings;
using Game.Simulation;
using Game.Tools;
using Game.UI.InGame;
using HarmonyLib;
using LemmyModFramework.hooks;
using LemmyModFramework.systems;
using Microsoft.CodeAnalysis;
using Unity.Entities;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Rendering.VirtualTexturing;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.5", FrameworkDisplayName = ".NET Framework 4.5")]
[assembly: AssemblyCompany("CinematicRendererMod_Framework")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CinematicRendererMod_Framework")]
[assembly: AssemblyTitle("CinematicRendererMod_Framework")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LemmyModFramework
{
	public class Globals
	{
		public static float FixedStepSimulationSpeed = 120f;

		public static float FixedStepSimulationSpeedDelta = 240f;

		public static bool fixedTimeActive = false;
	}
	public class Logger
	{
		public static ManualLogSource LogSource;

		public static void LogDebug(object data)
		{
			LogSource.Log((LogLevel)32, data);
		}

		public static void LogMessage(object data)
		{
			LogSource.Log((LogLevel)8, data);
		}

		public static void LogInfo(object data)
		{
			LogSource.Log((LogLevel)16, data);
		}

		public static void LogWarning(object data)
		{
			LogSource.Log((LogLevel)4, data);
		}

		public static void LogError(object data)
		{
			LogSource.Log((LogLevel)2, data);
		}
	}
	public class Patcher
	{
		public class MyBehaviour : MonoBehaviour
		{
			public void OnDestroy()
			{
				go = null;
			}
		}

		private class PatchResults
		{
			public MethodInfo pre;

			public MethodInfo post;

			public MethodInfo orig;
		}

		private static Harmony harmony;

		public static MonoBehaviour modBehaviour;

		private static GameObject go;

		public static void InjectSystems(UpdateSystem updateSystem)
		{
			updateSystem.UpdateBefore<PreSimulationSystem>((SystemUpdatePhase)12);
			updateSystem.UpdateAfter<PostSimulationSystem>((SystemUpdatePhase)12);
		}

		public static void TakeScreenshot(string filename)
		{
			//IL_001e: 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_0029: Expected O, but got Unknown
			if ((Object)(object)go == (Object)null || !go.activeInHierarchy)
			{
				GameObject val = new GameObject("LemmyMod");
				go = val;
				modBehaviour = (MonoBehaviour)(object)val.AddComponent<MyBehaviour>();
			}
			modBehaviour.StartCoroutine(CaptureScreenshot(filename));
		}

		internal static IEnumerator CaptureScreenshot(string filename)
		{
			yield return (object)new WaitForEndOfFrame();
			ScreenUtilityHooked.CaptureScreenshot(out var _, filename);
		}

		public static void Init(Harmony harmony)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Expected O, but got Unknown
			Patcher.harmony = harmony;
			PatchClass<SimulationSystem, SimulationSystemHooked>();
			PatchClass<CinematicCameraController, CinematicCameraControllerHooked>();
			PatchClass<CinematicCameraUISystem, CinematicCameraUISystemHooked>();
			PatchClass<BatchDataSystem, BatchDataSystemHooked>();
			PatchClass<WaterSystem, WaterSystemHooked>();
			PatchClass<CinemachineBrain, CinemachineBrainHooked>();
			PatchClass<WindControl, WindControlHooked>();
			PatchClass<WaterSimulationResources, WaterSimulationResourcesHooked>();
			MethodInfo method = typeof(ScreenUtilityHooked).GetMethod("CaptureScreenshot", BindingFlags.Static | BindingFlags.Public);
			MethodInfo method2 = typeof(ScreenUtility).GetMethod("CaptureScreenshot", BindingFlags.Static | BindingFlags.Public);
			harmony.Patch((MethodBase)method2, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			method = typeof(RenderingUtilsHooked).GetMethod("CalculateLodParameters", BindingFlags.Static | BindingFlags.Public);
			method2 = (from a in typeof(RenderingUtils).GetMethods()
				where a.Name.Contains("CalculateLodParameters")
				select a).ToList()[1];
			harmony.Patch((MethodBase)method2, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			method = typeof(AnimationSystemHooked).GetMethod("OnUpdate", BindingFlags.Static | BindingFlags.Public);
			method2 = typeof(AnimationSystem).GetMethod("OnUpdate", BindingFlags.Instance | BindingFlags.NonPublic);
			harmony.Patch((MethodBase)method2, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		public static void PatchClass<Type, SecondType>()
		{
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			Logger.LogInfo("Attempting to patch class: " + typeof(Type).Name);
			try
			{
				MethodInfo[] methods = typeof(SecondType).GetMethods();
				Dictionary<string, PatchResults> dictionary = new Dictionary<string, PatchResults>();
				MethodInfo[] array = methods;
				foreach (MethodInfo methodInfo in array)
				{
					if (!methodInfo.IsStatic)
					{
						continue;
					}
					string text = methodInfo.Name;
					bool flag = true;
					if (methodInfo.Name.StartsWith("Prefix_"))
					{
						flag = false;
						text = text.Substring(7);
					}
					PatchResults patchResults = new PatchResults();
					if (!dictionary.ContainsKey(text))
					{
						MethodInfo method = typeof(Type).GetMethod(text);
						if (method == null)
						{
							method = typeof(Type).GetMethod(text, BindingFlags.NonPublic);
						}
						if (method == null)
						{
							method = typeof(Type).GetMethod(text, BindingFlags.Instance);
						}
						if (method == null)
						{
							method = typeof(Type).GetMethod(text, BindingFlags.Instance | BindingFlags.NonPublic);
						}
						if (method == null)
						{
							Logger.LogError("Method was blank: " + typeof(Type).Name + "." + text + " - could not patch.");
							continue;
						}
						patchResults = (dictionary[text] = new PatchResults());
						patchResults.orig = method;
					}
					else
					{
						patchResults = dictionary[text];
					}
					if (flag)
					{
						patchResults.post = methodInfo;
					}
					else
					{
						patchResults.pre = methodInfo;
					}
				}
				foreach (KeyValuePair<string, PatchResults> item in dictionary)
				{
					PatchResults value = item.Value;
					string text2 = "\nPatching " + typeof(Type).Name + "." + value.orig.Name + "\n";
					if (value.pre != null)
					{
						text2 = text2 + "\tPre:\t" + typeof(SecondType).Name + "." + value.pre.Name + "\n";
					}
					if (value.post != null)
					{
						text2 = text2 + "\tPost:\t" + typeof(SecondType).Name + "." + value.post.Name + "\n";
					}
					Logger.LogInfo(text2);
					harmony.Patch((MethodBase)value.orig, (value.pre == null) ? ((HarmonyMethod)null) : new HarmonyMethod(value.pre), (value.post == null) ? ((HarmonyMethod)null) : new HarmonyMethod(value.post), (HarmonyMethod)null, (HarmonyMethod)null);
				}
			}
			catch (Exception ex)
			{
				Console.WriteLine(ex);
				Logger.LogError(ex);
				throw;
			}
		}
	}
	public class VideoRenderer
	{
		public struct SaveVideoData
		{
			public string dir { get; set; }

			public string assDir { get; set; }
		}

		private struct ImageData
		{
			public string fileName;

			public byte[] bytes;
		}

		public static VideoRenderer Instance = new VideoRenderer();

		public static string AssemblyDirectory => Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path));

		[DllImport("shell32.dll")]
		private static extern int SHGetKnownFolderPath([MarshalAs(UnmanagedType.LPStruct)] Guid rfid, uint dwFlags, IntPtr hToken, ref IntPtr ppszPath);

		public void GetVideoLibraryFolders()
		{
			IntPtr ppszPath = default(IntPtr);
			SHGetKnownFolderPath(new Guid("491E922F-5643-4AF4-A7EB-4E7A138D8174"), 0u, IntPtr.Zero, ref ppszPath);
			string? inputUri = Marshal.PtrToStringUni(ppszPath);
			Marshal.FreeCoTaskMem(ppszPath);
			List<string> list = new List<string>();
			using (XmlReader xmlReader = XmlReader.Create(inputUri))
			{
				while (xmlReader.ReadToFollowing("simpleLocation"))
				{
					xmlReader.ReadToFollowing("url");
					list.Add(xmlReader.ReadElementContentAsString());
				}
			}
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].Contains("knownfolder"))
				{
					list[i] = list[i].Replace("knownfolder:{", "");
					list[i] = list[i].Replace("}", "");
					SHGetKnownFolderPath(new Guid(list[i]), 0u, IntPtr.Zero, ref ppszPath);
					list[i] = Marshal.PtrToStringUni(ppszPath);
					Marshal.FreeCoTaskMem(ppszPath);
				}
			}
		}

		public void Render(int framerate = 60)
		{
			string assemblyDirectory = AssemblyDirectory;
			string dir = Path.Combine(Application.persistentDataPath, "VideoFrames");
			ThreadPool.UnsafeQueueUserWorkItem(SaveVideo, new SaveVideoData
			{
				dir = dir,
				assDir = assemblyDirectory
			});
		}

		private static void SaveVideo(object state)
		{
			SaveVideoData saveVideoData = ((state is SaveVideoData) ? ((SaveVideoData)state) : default(SaveVideoData));
			string assDir = saveVideoData.assDir;
			string dir = saveVideoData.dir;
			try
			{
				if (File.Exists(dir + "\\out.mp4"))
				{
					File.Delete(dir + "\\out.mp4");
				}
			}
			catch (Exception)
			{
			}
			try
			{
				Process process = new Process();
				process.StartInfo.FileName = "CMD.exe";
				string arguments = "/C .\\ffmpeg.exe -framerate 60 -pattern_type sequence -i \"" + dir + "\\Video_%05d.tga\" -c:v libx264 -pix_fmt yuv444p -s:v " + Screen.width + "x" + Screen.height + " \"" + dir + "\\out.mp4\"";
				process.StartInfo.Arguments = arguments;
				process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
				process.StartInfo.CreateNoWindow = false;
				process.StartInfo.WorkingDirectory = assDir;
				process.StartInfo.UseShellExecute = true;
				process.StartInfo.RedirectStandardOutput = false;
				process.Start();
				process.WaitForExit();
			}
			catch (Exception)
			{
			}
			try
			{
				IntPtr ppszPath = default(IntPtr);
				SHGetKnownFolderPath(new Guid("491E922F-5643-4AF4-A7EB-4E7A138D8174"), 0u, IntPtr.Zero, ref ppszPath);
				string? inputUri = Marshal.PtrToStringUni(ppszPath);
				Marshal.FreeCoTaskMem(ppszPath);
				List<string> list = new List<string>();
				using (XmlReader xmlReader = XmlReader.Create(inputUri))
				{
					while (xmlReader.ReadToFollowing("simpleLocation"))
					{
						xmlReader.ReadToFollowing("url");
						list.Add(xmlReader.ReadElementContentAsString());
					}
				}
				for (int i = 0; i < list.Count; i++)
				{
					if (list[i].Contains("knownfolder"))
					{
						list[i] = list[i].Replace("knownfolder:{", "");
						list[i] = list[i].Replace("}", "");
						SHGetKnownFolderPath(new Guid(list[i]), 0u, IntPtr.Zero, ref ppszPath);
						list[i] = Marshal.PtrToStringUni(ppszPath);
						Marshal.FreeCoTaskMem(ppszPath);
					}
				}
				string text = list[0];
				File.Copy(dir + "\\out.mp4", text + "\\" + DateTime.Now.ToString("yyyy-dd-M--HH-mm-ss") + ".mp4");
			}
			catch (Exception)
			{
				string text2 = Path.Combine(Application.persistentDataPath, "Videos");
				if (!Directory.Exists(text2))
				{
					Directory.CreateDirectory(text2);
				}
				File.Copy(dir + "\\out.mp4", text2 + "\\" + DateTime.Now.ToString("yyyy-dd-M--HH-mm-ss") + ".mp4");
			}
			try
			{
				string[] files = Directory.GetFiles(dir);
				foreach (string path in files)
				{
					try
					{
						File.Delete(path);
					}
					catch (Exception)
					{
					}
				}
			}
			catch (Exception)
			{
			}
			try
			{
				Directory.Delete(dir);
			}
			catch (Exception)
			{
			}
		}

		public void AddFrameToExport(byte[] pngdata, string fileName)
		{
			ThreadPool.QueueUserWorkItem(WriteImageToFile, new ImageData
			{
				fileName = fileName,
				bytes = pngdata
			});
		}

		private void WriteImageToFile(object state)
		{
			ImageData imageData = (ImageData)state;
			File.WriteAllBytes(imageData.fileName, imageData.bytes);
		}
	}
}
namespace LemmyModFramework.util
{
	public class DeepCloner
	{
		private const BindingFlags Binding = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;

		private Type _primaryType;

		private object _desireObjectToBeCloned;

		private bool collectionsOnly;

		public DeepCloner(object desireObjectToBeCloned)
		{
			if (desireObjectToBeCloned == null)
			{
				throw new Exception("The desire object to be cloned cant be NULL");
			}
			_primaryType = desireObjectToBeCloned.GetType();
			_desireObjectToBeCloned = desireObjectToBeCloned;
			collectionsOnly = false;
		}

		public DeepCloner(object desireObjectToBeCloned, bool collectionsOnly)
		{
			if (desireObjectToBeCloned == null)
			{
				throw new Exception("The desire object to be cloned cant be NULL");
			}
			_primaryType = desireObjectToBeCloned.GetType();
			_desireObjectToBeCloned = desireObjectToBeCloned;
			this.collectionsOnly = collectionsOnly;
		}

		private object DeepClone()
		{
			if (_desireObjectToBeCloned == null)
			{
				return null;
			}
			if (_primaryType.IsArray)
			{
				return ((Array)_desireObjectToBeCloned).Clone();
			}
			object obj = _desireObjectToBeCloned as IList;
			if (obj != null)
			{
				PropertyInfo[] properties = _primaryType.GetProperties();
				obj = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(properties[^1].PropertyType));
				IList list = (IList)obj;
				foreach (object item in (IList)_desireObjectToBeCloned)
				{
					if (item != null)
					{
						if (collectionsOnly)
						{
							list?.Add(item);
							continue;
						}
						object value = new DeepCloner(item, collectionsOnly).DeepClone();
						list?.Add(value);
					}
				}
			}
			else
			{
				if (_primaryType == typeof(string))
				{
					return (_desireObjectToBeCloned as string)?.Clone();
				}
				obj = FormatterServices.GetUninitializedObject(_primaryType);
				FieldInfo[] fields = _desireObjectToBeCloned.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
				foreach (FieldInfo fieldInfo in fields)
				{
					if (fieldInfo.IsInitOnly)
					{
						continue;
					}
					object value2 = fieldInfo.GetValue(_desireObjectToBeCloned);
					if (fieldInfo.FieldType.IsClass && fieldInfo.FieldType != typeof(string))
					{
						object obj2 = value2 as IList;
						if (collectionsOnly && obj2 == null)
						{
							obj.GetType().GetField(fieldInfo.Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy)?.SetValue(obj, value2);
							continue;
						}
						object value3 = new DeepCloner(value2, collectionsOnly).DeepClone();
						obj.GetType().GetField(fieldInfo.Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy)?.SetValue(obj, value3);
					}
					else
					{
						obj.GetType().GetField(fieldInfo.Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy)?.SetValue(obj, value2);
					}
				}
			}
			return obj;
		}

		public object Clone()
		{
			return DeepClone();
		}

		public T Clone<T>()
		{
			return (T)DeepClone();
		}
	}
}
namespace LemmyModFramework.systems
{
	public class PreSimulationSystem : GameSystemBase
	{
		protected override void OnUpdate()
		{
		}
	}
	public class PostSimulationSystem : GameSystemBase
	{
		protected override void OnUpdate()
		{
		}
	}
}
namespace LemmyModFramework.src.hooks
{
	public class VFXVelocityBinderHooked
	{
	}
}
namespace LemmyModFramework.hooks
{
	public class AdaptiveDynamicResolutionScaleHooked
	{
		public static void SetParams(AdaptiveDynamicResolutionScale __instance, bool enabled, bool adaptive, float minScale, DynResUpscaleFilter filter, Camera camera)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Resolution currentResolution = Screen.currentResolution;
			if (((Resolution)(ref currentResolution)).height < 8640)
			{
				Screen.SetResolution(15360, 8640, (FullScreenMode)2, 120);
			}
		}
	}
	public class AnimationSystemHooked
	{
		public static bool OnUpdate(AnimationSystem __instance)
		{
			//IL_0043: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_0077: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			float fixedStepSimulationSpeedDelta = Globals.FixedStepSimulationSpeedDelta;
			float unscaledDeltaTime = Time.unscaledDeltaTime;
			unscaledDeltaTime = 1f / fixedStepSimulationSpeedDelta;
			__instance.__TypeHandle.__Game_Tools_Animation_RW_ComponentTypeHandle.Update(ref ((SystemBase)__instance).CheckedStateRef);
			__instance.__TypeHandle.__Game_Objects_Transform_RO_ComponentTypeHandle.Update(ref ((SystemBase)__instance).CheckedStateRef);
			((SystemBase)__instance).Dependency = JobChunkExtensions.ScheduleParallel<AnimateJob>(new AnimateJob
			{
				m_DeltaTime = unscaledDeltaTime,
				m_TransformType = __instance.__TypeHandle.__Game_Objects_Transform_RO_ComponentTypeHandle,
				m_AnimationType = __instance.__TypeHandle.__Game_Tools_Animation_RW_ComponentTypeHandle
			}, __instance.m_AnimatedQuery, ((SystemBase)__instance).Dependency);
			return false;
		}
	}
	public class BatchDataSystemHooked
	{
		public static bool Prefix_GetLevelOfDetail(ref float __result, BatchDataSystem __instance, float levelOfDetail, IGameCameraController cameraController)
		{
			if (cameraController != null)
			{
				levelOfDetail *= (float)(1.0 - 1.0 / (2.0 + 0.009999999776482582 * (double)cameraController.zoom));
			}
			__result = levelOfDetail;
			return false;
		}
	}
	public class CinemachineBrainHooked
	{
		public bool Prefix_GetEffectiveDeltaTime(ref float __result, CinemachineBrain __instance, bool fixedDelta)
		{
			if (!Globals.fixedTimeActive)
			{
				return true;
			}
			float fixedStepSimulationSpeedDelta = Globals.FixedStepSimulationSpeedDelta;
			float unscaledDeltaTime = Time.unscaledDeltaTime;
			unscaledDeltaTime = 1f / fixedStepSimulationSpeedDelta;
			__result = unscaledDeltaTime;
			return false;
		}
	}
	public class CinematicCameraControllerHooked
	{
		public static bool Prefix_UpdateController(CinematicCameraController __instance, Input input)
		{
			//IL_002e: 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_003a: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: 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)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			if (!Globals.fixedTimeActive)
			{
				return true;
			}
			float fixedStepSimulationSpeedDelta = Globals.FixedStepSimulationSpeedDelta;
			__instance.m_RestrictToTerrain.Refresh();
			float unscaledDeltaTime = Time.unscaledDeltaTime;
			unscaledDeltaTime = 1f / fixedStepSimulationSpeedDelta;
			Vector3 position = __instance.m_Anchor.position;
			float num = default(float);
			__instance.m_RestrictToTerrain.ClampToTerrain(position, true, ref num);
			float num2 = Mathf.Min(position.y - num, __instance.m_MaxMovementSpeedHeight) / __instance.m_MaxMovementSpeedHeight;
			Vector2 val = ((Input)(ref input)).move;
			if ((double)((Vector2)(ref val)).sqrMagnitude > 1.0)
			{
				((Vector2)(ref val)).Normalize();
			}
			val *= unscaledDeltaTime * Mathf.Lerp(__instance.m_MinMoveSpeed, __instance.m_MaxMoveSpeed, num2);
			Vector2 val2 = ((Input)(ref input)).rotate * unscaledDeltaTime * __instance.m_RotateSpeed + ((Input)(ref input)).mouseRotate * __instance.m_MouseRotateSpeed;
			float num3 = (float)((double)((Input)(ref input)).zoom * (double)Mathf.Lerp(__instance.m_MinZoomSpeed, __instance.m_MaxZoomSpeed, num2) * (double)unscaledDeltaTime + (double)((Input)(ref input)).mouseZoom * (double)Mathf.Lerp(__instance.m_MinMouseZoomSpeed, __instance.m_MaxMouseZoomSpeed, num2));
			Quaternion rotation = __instance.m_Anchor.rotation;
			Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
			float num4 = default(float);
			Vector3 val3 = __instance.m_RestrictToTerrain.ClampToTerrain(position + Quaternion.AngleAxis(eulerAngles.y, Vector3.up) * new Vector3(val.x, 0f - num3, val.y), true, ref num4);
			val3.y = Mathf.Min(val3.y, num4 + __instance.m_MaxHeight);
			Quaternion val4 = Quaternion.Euler(Mathf.Clamp((float)(((double)eulerAngles.x + 90.0) % 360.0) - val2.y, 0f, 180f) - 90f, eulerAngles.y + val2.x, 0f);
			Vector3 val5 = default(Vector3);
			__instance.m_Anchor.position = ((!__instance.m_RestrictToTerrain.enableObjectCollisions || !__instance.m_RestrictToTerrain.CheckForCollision(val3, __instance.m_RestrictToTerrain.previousPosition, val4, ref val5)) ? val3 : val5);
			__instance.m_Anchor.rotation = val4;
			return false;
		}
	}
	internal class CinematicCameraUISystemHooked
	{
		private static int frame;

		private static bool recording;

		private static bool was_playing;

		private static Resolution res;

		public static bool Prefix_set_playing(CinematicCameraUISystem __instance)
		{
			was_playing = __instance.m_Playing;
			return true;
		}

		public static void set_playing(CinematicCameraUISystem __instance)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.m_Playing && !was_playing)
			{
				frame = 0;
				recording = true;
				float fixedStepSimulationSpeedDelta = Globals.FixedStepSimulationSpeedDelta;
				_ = Time.unscaledDeltaTime;
				Time.captureDeltaTime = 1f / fixedStepSimulationSpeedDelta;
				res = Screen.currentResolution;
				Globals.fixedTimeActive = true;
				try
				{
					string path = Path.Combine(Application.persistentDataPath, "VideoFrames");
					try
					{
						string[] files = Directory.GetFiles(path);
						foreach (string path2 in files)
						{
							try
							{
								File.Delete(path2);
							}
							catch (Exception)
							{
							}
						}
					}
					catch (Exception)
					{
					}
					Directory.Delete(path);
					return;
				}
				catch (Exception)
				{
					return;
				}
			}
			if (!__instance.m_Playing && was_playing)
			{
				frame = 0;
				if (recording)
				{
					VideoRenderer.Instance.Render();
				}
				recording = false;
				Time.captureDeltaTime = 0f;
				Globals.fixedTimeActive = false;
			}
		}

		public static bool Prefix_UpdatePlayback(CinematicCameraUISystem __instance)
		{
			if (!Globals.fixedTimeActive)
			{
				Time.captureDeltaTime = 0f;
				return true;
			}
			float fixedStepSimulationSpeedDelta = Globals.FixedStepSimulationSpeedDelta;
			float unscaledDeltaTime = Time.unscaledDeltaTime;
			unscaledDeltaTime = 1f / fixedStepSimulationSpeedDelta;
			if (__instance.playing)
			{
				Time.captureDeltaTime = unscaledDeltaTime;
			}
			__instance.t += unscaledDeltaTime * 4f;
			CinematicCameraSequence val = __instance.m_ActiveAutoplaySequence ?? __instance.activeSequence;
			if ((double)__instance.t >= (double)val.playbackDuration)
			{
				if (val.loop)
				{
					__instance.t -= val.playbackDuration;
				}
				else
				{
					__instance.playing = false;
				}
				recording = false;
			}
			__instance.t = Mathf.Min(__instance.t, val.playbackDuration);
			val.Refresh(__instance.t, (IDictionary<string, PhotoModeProperty>)__instance.m_PhotoModeRenderSystem.photoModeProperties, __instance.m_CameraUpdateSystem.activeCameraController);
			string text = "Video_";
			if (__instance.m_Playing && recording)
			{
				string text2 = frame.ToString();
				while (text2.Length < 5)
				{
					text2 = "0" + text2;
				}
				text += text2;
				Patcher.TakeScreenshot(text);
				frame++;
			}
			else
			{
				frame = 0;
				Globals.fixedTimeActive = false;
				Time.captureDeltaTime = 0f;
				if (recording)
				{
					recording = false;
					VideoRenderer.Instance.Render();
				}
			}
			return false;
		}
	}
	internal class DynamicResolutionHandlerHooked
	{
		public static bool Prefix_FlushScalableBufferManagerState(DynamicResolutionHandler __instance)
		{
			DynamicResolutionHandler.s_GlobalHwUpresActive = __instance.HardwareDynamicResIsEnabled();
			DynamicResolutionHandler.s_GlobalHwFraction = __instance.m_CurrentFraction;
			ScalableBufferManager.ResizeBuffers(3f, 3f);
			return false;
		}

		public static bool Prefix_ProcessSettings(DynamicResolutionHandler __instance, GlobalDynamicResolutionSettings settings)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			__instance.m_ForceSoftwareFallback = false;
			if (!settings.forceResolution)
			{
				DynamicResolutionHandler.s_ActiveInstanceDirty = true;
			}
			settings.forceResolution = true;
			settings.forcedPercentage = 300f;
			__instance.m_Enabled = settings.enabled && (Application.isPlaying || settings.forceResolution);
			if (!__instance.m_Enabled)
			{
				__instance.m_CurrentFraction = 1f;
			}
			else
			{
				__instance.type = settings.dynResType;
				__instance.m_UseMipBias = settings.useMipBias;
				__instance.m_MinScreenFraction = 1f;
				__instance.m_MaxScreenFraction = 3f;
				__instance.filter = (DynamicResolutionHandler.s_CameraUpscaleFilters.TryGetValue(DynamicResolutionHandler.s_ActiveCameraId, out var value) ? value : settings.upsampleFilter);
				__instance.m_ForcingRes = settings.forceResolution;
				if (__instance.m_ForcingRes)
				{
					__instance.m_CurrentFraction = Mathf.Clamp(settings.forcedPercentage / 100f, 0.1f, 3f);
				}
			}
			__instance.m_CachedSettings = settings;
			return false;
		}
	}
	public class RenderingUtilsHooked
	{
		public static bool CalculateLodParameters(ref float4 __result, float lodFactor, LODParameters lodParameters)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			float num = 1f / math.tan(math.radians(((LODParameters)(ref lodParameters)).fieldOfView * 0.5f));
			lodFactor *= 540f * num;
			__result = new float4(lodFactor, (float)(1.0 / ((double)lodFactor * (double)lodFactor)), num + 1f, num);
			return false;
		}
	}
	public class ScreenUtilityHooked
	{
		public static bool CaptureScreenshot(out string __result, string fileName = null, int supersize = 1)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (fileName == null)
			{
				__result = "";
				return true;
			}
			Texture2D val = ScreenCapture.CaptureScreenshotAsTexture(supersize);
			string text = Path.Combine(Application.persistentDataPath, "VideoFrames");
			if (!Directory.Exists(text))
			{
				Directory.CreateDirectory(text);
			}
			string text2 = Path.Combine(text, Path.ChangeExtension(fileName, ".tga"));
			byte[] pngdata = ImageConversion.EncodeArrayToTGA((Array)val.GetRawTextureData(), ((Texture)val).graphicsFormat, (uint)((Texture)val).width, (uint)((Texture)val).height, 0u);
			VideoRenderer.Instance.AddFrameToExport(pngdata, text2);
			Object.DestroyImmediate((Object)(object)val);
			__result = text2;
			return false;
		}
	}
	public class SimulationSystemHooked
	{
		public static bool Prefix_OnUpdate()
		{
			if (Globals.fixedTimeActive)
			{
				return false;
			}
			return true;
		}

		public static void OnUpdate(SimulationSystem __instance)
		{
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			if (!Globals.fixedTimeActive)
			{
				return;
			}
			int num = (int)(120f / Globals.FixedStepSimulationSpeed);
			if (num < 1)
			{
				num = 1;
			}
			float fixedStepSimulationSpeedDelta = Globals.FixedStepSimulationSpeedDelta;
			float num2 = 1f / fixedStepSimulationSpeedDelta;
			((JobHandle)(ref __instance.m_WatchDeps)).Complete();
			__instance.frameDuration = num2;
			__instance.m_Stopwatch.Reset();
			__instance.m_StepCount = num;
			if (__instance.m_IsLoading)
			{
				if ((double)__instance.loadingProgress != 1.0)
				{
					__instance.UpdateLoadingProgress();
					return;
				}
				if (!GameManager.instance.isGameLoading)
				{
					__instance.m_IsLoading = false;
					SharedSettings instance = SharedSettings.instance;
					GameplaySettings val = ((instance != null) ? instance.gameplay : null);
					__instance.selectedSpeed = ((val == null || !val.pausedAfterLoading) ? 1f : 0f);
				}
			}
			else if (GameManager.instance.isGameLoading)
			{
				__instance.selectedSpeed = 0f;
				num = (__instance.m_StepCount = 0);
			}
			if ((double)__instance.selectedSpeed == 0.0)
			{
				__instance.smoothSpeed = 0f;
				num = (__instance.m_StepCount = 0);
			}
			else
			{
				__instance.smoothSpeed = 1f;
				float num3 = num2 * __instance.selectedSpeed;
				__instance.m_Timer += num3;
				int num4 = (int)Mathf.Floor(__instance.m_Timer * 60f);
				__instance.m_Timer = Mathf.Clamp(__instance.m_Timer - (float)num4 / 60f, 0f, num2);
			}
			__instance.frameTime = __instance.m_Timer * 60f;
			__instance.m_LastSpeed = __instance.selectedSpeed;
			__instance.m_UpdateSystem.Update((SystemUpdatePhase)10);
			for (int i = 0; i < num; i++)
			{
				__instance.m_StepCount = num;
				__instance.m_Stopwatch.Start();
				uint frameIndex = __instance.frameIndex + 1;
				__instance.frameIndex = frameIndex;
				if (GameModeExtensions.IsEditor(__instance.m_ToolSystem.actionMode))
				{
					__instance.m_UpdateSystem.Update((SystemUpdatePhase)13, __instance.frameIndex, 0);
				}
				if (GameModeExtensions.IsGame(__instance.m_ToolSystem.actionMode))
				{
					__instance.m_UpdateSystem.Update((SystemUpdatePhase)12, __instance.frameIndex, 0);
				}
				SimulationEndTimeJob val2 = default(SimulationEndTimeJob);
				val2.m_Stopwatch = GCHandle.Alloc(__instance.m_Stopwatch);
				SimulationEndTimeJob val3 = val2;
				__instance.m_WatchDeps = IJobExtensions.Schedule<SimulationEndTimeJob>(val3, __instance.m_EndFrameBarrier.producerHandle);
			}
			__instance.m_UpdateSystem.Update((SystemUpdatePhase)11);
		}
	}
	public class TextureStreamingSystemHooked
	{
		public static bool Initialize(TextureStreamingSystem __instance, int desiredMipBias, FilterMode filterMode)
		{
			//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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0077: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Expected O, but got Unknown
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Expected O, but got Unknown
			__instance.CleanupVT();
			__instance.m_VirtualTexturingConfig.filterMode = filterMode;
			__instance.m_MipBias = Mathf.Max(__instance.m_DatasetMipBias, desiredMipBias);
			__instance.m_VtProceduralCPU = new VTProceduralCPU(__instance.m_VirtualTexturingConfig);
			__instance.m_VtDatabase = new VTDatabase(__instance.m_VirtualTexturingConfig, __instance.m_AtlasMaterialsGrouper.midMipLevelsCount, (IVTStackCreator)(object)__instance.m_VtProceduralCPU);
			if (__instance.m_AtlasMaterialsGrouper.IsInitialized)
			{
				__instance.m_AtlasMaterialsGrouper.PreRegisterToVT(__instance);
			}
			foreach (SurfaceAsset asset in AssetDatabase.global.GetAssets<SurfaceAsset>(default(SearchFilter<SurfaceAsset>)))
			{
				asset.ClearVTAtlassingInfos();
				if (!__instance.m_AtlasMaterialsGrouper.SetPreReservedIndex(asset))
				{
					if (asset.isVTMaterial)
					{
						asset.RegisterToVT(__instance);
						__instance.m_VTAssetsToInit.Enqueue(asset);
					}
				}
				else if (__instance.m_AtlasMaterialsGrouper.IsDuplicate(((AssetData)asset).guid))
				{
					__instance.m_VTAssetsShallowInit.Enqueue(asset);
				}
				else
				{
					__instance.m_VTAssetsToInit.Enqueue(asset);
				}
			}
			__instance.m_VTMaterialsCountToLoad = __instance.m_VTAssetsToInit.Count;
			__instance.m_VTMaterialsDuplicatesCountToInit = __instance.m_VTAssetsShallowInit.Count;
			RenderTexture val = new RenderTexture(1, 1, (GraphicsFormat)49, (GraphicsFormat)0);
			((Object)val).name = "VTWorkingSetBiasReadbackRT";
			__instance.m_WorkingSetLodBiasRT = val;
			__instance.m_WorkingSetLodBiasRT.Create();
			Material val2 = new Material(Resources.Load<Shader>("VirtualTexturingBiasReadback"));
			((Object)val2).name = "VTWorkingSetBiasReadback";
			__instance.m_WorkingSetLodBiasMat = val2;
			return false;
		}
	}
	public class WaterSimulationResourcesHooked
	{
		private static float time_since_startup;

		public static bool Prefix_Update(WaterSimulationResources __instance, float timeMultiplier)
		{
			if (!Globals.fixedTimeActive)
			{
				return true;
			}
			float fixedStepSimulationSpeedDelta = Globals.FixedStepSimulationSpeedDelta;
			float num = 1f / fixedStepSimulationSpeedDelta;
			__instance.m_Time = time_since_startup;
			__instance.deltaTime = num;
			__instance.simulationTime += num;
			time_since_startup += num;
			return false;
		}
	}
	public class WaterSystemHooked
	{
		public static void SourceStep(WaterSystem __instance)
		{
			if (Globals.fixedTimeActive)
			{
				float fixedStepSimulationSpeedDelta = Globals.FixedStepSimulationSpeedDelta;
				float unscaledDeltaTime = Time.unscaledDeltaTime;
				unscaledDeltaTime = 1f / fixedStepSimulationSpeedDelta;
				__instance.m_TimeStep = unscaledDeltaTime * 1E-08f;
				__instance.TimeStepOverride = unscaledDeltaTime * 1E-08f;
			}
		}
	}
	public class WindControlHooked
	{
		private static float time;

		public static bool Prefix_SetGlobalProperties(WindControl __instance, CommandBuffer cmd, WindVolumeComponent wind)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_0445: Unknown result type (might be due to invalid IL or missing references)
			//IL_0476: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			if (!Globals.fixedTimeActive)
			{
				return true;
			}
			ProfilingScope val = default(ProfilingScope);
			((ProfilingScope)(ref val))..ctor(cmd, ProfilingSampler.Get<ProfileId>((ProfileId)13));
			try
			{
				float fixedStepSimulationSpeedDelta = Globals.FixedStepSimulationSpeedDelta;
				float num = 1f / fixedStepSimulationSpeedDelta;
				float num2 = time;
				time += num;
				float3 val2 = math.mul(quaternion.Euler(0f, math.radians(((VolumeParameter<float>)(object)wind.windDirection).value) + math.cos((float)Math.PI * 2f * num2 / ((VolumeParameter<float>)(object)wind.windDirectionVariancePeriod).value) * math.radians(((VolumeParameter<float>)(object)wind.windDirectionVariance).value), 0f, (RotationOrder)4), WindControl.kForward);
				float3 val3 = math.mul(quaternion.Euler(0f, ((VolumeParameter<float>)(object)wind.windDirection).value, 0f, (RotationOrder)4), WindControl.kForward);
				float num3 = ((VolumeParameter<AnimationCurve>)(object)wind.windGustStrengthControl).value.Evaluate(num2);
				float num4 = ((VolumeParameter<AnimationCurve>)(object)wind.windTreeGustStrengthControl).value.Evaluate(num2);
				ref ShaderVariablesWind shaderVariablesWindCB = ref __instance.m_ShaderVariablesWindCB;
				float4 val4 = new float4(val2, 1f);
				float4 val5 = new float4(val3, num2);
				float4 zero = float4.zero;
				zero.w = math.min(1f, (Time.fixedTime - __instance._LastParametersSamplingTime) / ((VolumeParameter<float>)(object)wind.windParameterInterpolationDuration).value);
				shaderVariablesWindCB._WindData_0 = float4x4.op_Implicit(math.transpose(new float4x4(val4, val5, zero, new float4(__instance._WindBaseStrengthPhase.previous, __instance._WindBaseStrengthPhase2.previous, __instance._WindBaseStrengthPhase.current, __instance._WindBaseStrengthPhase2.current))));
				__instance.m_ShaderVariablesWindCB._WindData_1 = float4x4.op_Implicit(math.transpose(new float4x4(new float4(((VolumeParameter<float>)(object)wind.windBaseStrength).value * ((VolumeParameter<float>)(object)wind.windGlobalStrengthScale).value * ((VolumeParameter<float>)(object)wind.windGlobalStrengthScale2).value, ((VolumeParameter<float>)(object)wind.windBaseStrengthOffset).value, ((VolumeParameter<float>)(object)wind.windTreeBaseStrength).value * ((VolumeParameter<float>)(object)wind.windGlobalStrengthScale).value * ((VolumeParameter<float>)(object)wind.windGlobalStrengthScale2).value, ((VolumeParameter<float>)(object)wind.windTreeBaseStrengthOffset).value), new float4(0f, ((VolumeParameter<float>)(object)wind.windGustStrength).value * num3 * ((VolumeParameter<float>)(object)wind.windGlobalStrengthScale).value * ((VolumeParameter<float>)(object)wind.windGlobalStrengthScale2).value, ((VolumeParameter<float>)(object)wind.windGustStrengthOffset).value, __instance._WindFlutterGustVariancePeriod.current), new float4(__instance._WindGustStrengthVariancePeriod.current, __instance._WindGustStrengthVariancePeriod.previous, ((VolumeParameter<float>)(object)wind.windGustInnerCosScale).value, ((VolumeParameter<float>)(object)wind.windFlutterStrength).value * ((VolumeParameter<float>)(object)wind.windGlobalStrengthScale).value * ((VolumeParameter<float>)(object)wind.windGlobalStrengthScale2).value), new float4(((VolumeParameter<float>)(object)wind.windFlutterGustStrength).value * ((VolumeParameter<float>)(object)wind.windGlobalStrengthScale).value * ((VolumeParameter<float>)(object)wind.windGlobalStrengthScale2).value, ((VolumeParameter<float>)(object)wind.windFlutterGustStrengthOffset).value, ((VolumeParameter<float>)(object)wind.windFlutterGustStrengthScale).value, __instance._WindFlutterGustVariancePeriod.previous))));
				__instance.m_ShaderVariablesWindCB._WindData_2 = float4x4.op_Implicit(math.transpose(new float4x4(new float4(__instance._WindTreeBaseStrengthPhase.previous, __instance._WindTreeBaseStrengthPhase2.previous, __instance._WindTreeBaseStrengthPhase.current, __instance._WindTreeBaseStrengthPhase2.current), new float4(0f, ((VolumeParameter<float>)(object)wind.windTreeGustStrength).value * num4 * ((VolumeParameter<float>)(object)wind.windGlobalStrengthScale).value * ((VolumeParameter<float>)(object)wind.windGlobalStrengthScale2).value, ((VolumeParameter<float>)(object)wind.windTreeGustStrengthOffset).value, __instance._WindTreeFlutterGustVariancePeriod.current), new float4(__instance._WindTreeGustStrengthVariancePeriod.current, __instance._WindTreeGustStrengthVariancePeriod.previous, ((VolumeParameter<float>)(object)wind.windTreeGustInnerCosScale).value, ((VolumeParameter<float>)(object)wind.windTreeFlutterStrength).value * ((VolumeParameter<float>)(object)wind.windGlobalStrengthScale).value * ((VolumeParameter<float>)(object)wind.windGlobalStrengthScale2).value), new float4(((VolumeParameter<float>)(object)wind.windTreeFlutterGustStrength).value * ((VolumeParameter<float>)(object)wind.windGlobalStrengthScale).value * ((VolumeParameter<float>)(object)wind.windGlobalStrengthScale2).value, ((VolumeParameter<float>)(object)wind.windTreeFlutterGustStrengthOffset).value, ((VolumeParameter<float>)(object)wind.windTreeFlutterGustStrengthScale).value, __instance._WindTreeFlutterGustVariancePeriod.previous))));
				__instance.m_ShaderVariablesWindCB._WindData_3 = float4x4.op_Implicit(math.transpose(new float4x4(new float4(__instance._WindBaseStrengthVariancePeriod.previous, __instance._WindTreeBaseStrengthVariancePeriod.previous, __instance._WindBaseStrengthVariancePeriod.previous, __instance._WindTreeBaseStrengthVariancePeriod.current), new float4(__instance._WindGustStrengthPhase.previous, __instance._WindGustStrengthPhase2.previous, __instance._WindGustStrengthPhase.current, __instance._WindGustStrengthPhase2.current), new float4(__instance._WindTreeGustStrengthPhase.previous, __instance._WindTreeGustStrengthPhase2.previous, __instance._WindTreeGustStrengthPhase.current, __instance._WindTreeGustStrengthPhase2.current), new float4(0f, 0f, 0f, 0f))));
				ConstantBuffer.PushGlobal<ShaderVariablesWind>(cmd, ref __instance.m_ShaderVariablesWindCB, WindControl.m_ShaderVariablesWind);
			}
			finally
			{
				((IDisposable)(ProfilingScope)(ref val)).Dispose();
			}
			return false;
		}

		public static bool Prefix_UpdateCPUData(WindControl __instance, WindVolumeComponent wind)
		{
			if (!Globals.fixedTimeActive)
			{
				return true;
			}
			float fixedStepSimulationSpeedDelta = Globals.FixedStepSimulationSpeedDelta;
			_ = 1f / fixedStepSimulationSpeedDelta;
			__instance._LastParametersSamplingTime = time;
			__instance._WindBaseStrengthPhase.Update(((VolumeParameter<float>)(object)wind.windBaseStrengthPhase).value);
			__instance._WindBaseStrengthPhase2.Update(((VolumeParameter<float>)(object)wind.windBaseStrengthPhase2).value);
			__instance._WindTreeBaseStrengthPhase.Update(((VolumeParameter<float>)(object)wind.windTreeBaseStrengthPhase).value);
			__instance._WindTreeBaseStrengthPhase2.Update(((VolumeParameter<float>)(object)wind.windTreeBaseStrengthPhase2).value);
			__instance._WindBaseStrengthVariancePeriod.Update(((VolumeParameter<float>)(object)wind.windBaseStrengthVariancePeriod).value);
			__instance._WindTreeBaseStrengthVariancePeriod.Update(((VolumeParameter<float>)(object)wind.windTreeBaseStrengthVariancePeriod).value);
			__instance._WindGustStrengthPhase.Update(((VolumeParameter<float>)(object)wind.windGustStrengthPhase).value);
			__instance._WindGustStrengthPhase2.Update(((VolumeParameter<float>)(object)wind.windGustStrengthPhase2).value);
			__instance._WindTreeGustStrengthPhase.Update(((VolumeParameter<float>)(object)wind.windTreeGustStrengthPhase).value);
			__instance._WindTreeGustStrengthPhase2.Update(((VolumeParameter<float>)(object)wind.windTreeGustStrengthPhase2).value);
			__instance._WindGustStrengthVariancePeriod.Update(((VolumeParameter<float>)(object)wind.windGustStrengthVariancePeriod).value);
			__instance._WindTreeGustStrengthVariancePeriod.Update(((VolumeParameter<float>)(object)wind.windTreeGustStrengthVariancePeriod).value);
			__instance._WindFlutterGustVariancePeriod.Update(((VolumeParameter<float>)(object)wind.windFlutterGustVariancePeriod).value);
			__instance._WindTreeFlutterGustVariancePeriod.Update(((VolumeParameter<float>)(object)wind.windTreeFlutterGustVariancePeriod).value);
			return false;
		}
	}
}