Decompiled source of Coop View v1.0.5

CoopView.dll

Decompiled a day 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.Security;
using System.Security.Permissions;
using BepInEx;
using CoopKBnM;
using HarmonyLib;
using InControl;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CoopView")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CoopView")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("825bc8e2-2faf-496c-803c-3f3e31eba1a0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace CoopView;

[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("kleirof.etg.coopview", "Coop View", "1.0.5")]
public class CoopViewModule : BaseUnityPlugin
{
	public const string GUID = "kleirof.etg.coopview";

	public const string NAME = "Coop View";

	public const string VERSION = "1.0.5";

	public const string TEXT_COLOR = "#CCFF33";

	private GameObject coopViewObject;

	public void Start()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		ETGModMainBehaviour.WaitForGameManagerStart((Action<GameManager>)GMStart);
		Harmony val = new Harmony("kleirof.etg.coopview");
		val.PatchAll();
		coopViewObject = new GameObject("Coop View Object");
		Object.DontDestroyOnLoad((Object)(object)coopViewObject);
		coopViewObject.AddComponent<ViewController>();
	}

	public void Update()
	{
		if ((Object)(object)OptionsManager.videoOptionsScrollablePanelObject == (Object)null && !OptionsManager.isInitializingOptions)
		{
			((MonoBehaviour)this).StartCoroutine(OptionsManager.InitializeOptions());
		}
	}

	public void OnApplicationQuit()
	{
		WindowManager.ReleaseWindowHook();
		ShortcutKeyHandler.ReleaseMessageHandler();
	}

	public static void Log(string text, string color = "FFFFFF")
	{
		ETGModConsole.Log((object)("<color=" + color + ">" + text + "</color>"), false);
	}

	private static void LogCommands()
	{
		ETGModConsole.Log((object)"", false);
		ETGModConsole.Log((object)"Command list:", false);
		ETGModConsole.Log((object)"[The content in square brackets can be omitted. ]", false);
		ETGModConsole.Log((object)"  -- <color=#CCFF33>shortcutkey [shortcut_key_ID]</color>", false);
		ETGModConsole.Log((object)"     - Set custom shortcut keys.", false);
		ETGModConsole.Log((object)"     - The shortcut key ID should be specified from 1 to 5 in the parameters, like 'shortcutkey 1'.", false);
		ETGModConsole.Log((object)"     - Current shortcut keys and its shortcut key ID will be displayed to give you a hint.", false);
		ETGModConsole.Log((object)"  -- <color=#CCFF33>switchpreset [preset_index]</color>", false);
		ETGModConsole.Log((object)"     - Switch to the next window position preset (3 in total).", false);
		ETGModConsole.Log((object)"     - The preset index can be specified from 0 to 2 in the parameters, like 'switchpreset 2'.", false);
		ETGModConsole.Log((object)"        - preset_index = 0 :  Main window fullscreen on monitor 1, second window fullscreen on monitor 2.", false);
		ETGModConsole.Log((object)"        - preset_index = 1 :  Main window fullscreen on monitor 2, second window fullscreen on monitor 1.", false);
		ETGModConsole.Log((object)"        - preset_index = 2 :  Main window windowed on monitor 1, second window windowed on monitor 1.", false);
		ETGModConsole.Log((object)"  -- <color=#CCFF33>secondwindow fullscreen [monitor_index]</color>", false);
		ETGModConsole.Log((object)"     - Switch the second window to fullscreen mode.", false);
		ETGModConsole.Log((object)"     - The target monitor can be specified in the parameters, like 'secondwindow fullscreen 1'.", false);
		ETGModConsole.Log((object)"  -- <color=#CCFF33>secondwindow windowed [width] [height]</color>", false);
		ETGModConsole.Log((object)"     - Switch the second window to windowed mode.", false);
		ETGModConsole.Log((object)"     - The window size can be specified in the parameters, like 'secondwindow windowed 1920 1080'.", false);
		ETGModConsole.Log((object)"  -- <color=#CCFF33>mainwindow fullscreen [monitor_index]</color>", false);
		ETGModConsole.Log((object)"     - Switch the main window to fullscreen mode.", false);
		ETGModConsole.Log((object)"     - The target monitor can be specified in the parameters, like 'mainwindow fullscreen 1'.", false);
		ETGModConsole.Log((object)" -- <color=#CCFF33>mainwindow windowed [width] [height]</color>", false);
		ETGModConsole.Log((object)"     - Switch the main window to windowed mode.", false);
		ETGModConsole.Log((object)"     - The window size can be specified in the parameters, like 'mainwindow windowed 1920 1080'.", false);
	}

	private static void LogHelp(string[] args)
	{
		ShortcutKeyHandler.LogShortcutKeys();
		LogCommands();
	}

	public void GMStart(GameManager g)
	{
		Log("Coop View v1.0.5 started successfully.", "#CCFF33");
		ETGModConsole.Log((object)"<color=#CCFF33>Enter 'coopview help' for more options.</color>", false);
		ETGModConsole.Commands.AddGroup("coopview", (Action<string[]>)LogHelp);
		ETGModConsole.Commands.GetGroup("coopview").AddUnit("help", (Action<string[]>)LogHelp);
		ETGModConsole.Commands.AddGroup("secondwindow", (Action<string[]>)LogHelp);
		ETGModConsole.Commands.GetGroup("secondwindow").AddUnit("fullscreen", (Action<string[]>)WindowManager.SwitchSecondWindowToFullscreen);
		ETGModConsole.Commands.GetGroup("secondwindow").AddUnit("windowed", (Action<string[]>)WindowManager.SwitchSecondWindowToWindowed);
		ETGModConsole.Commands.AddGroup("mainwindow", (Action<string[]>)LogHelp);
		ETGModConsole.Commands.GetGroup("mainwindow").AddUnit("fullscreen", (Action<string[]>)WindowManager.SwitchMainWindowToFullscreen);
		ETGModConsole.Commands.GetGroup("mainwindow").AddUnit("windowed", (Action<string[]>)WindowManager.SwitchMainWindowToWindowed);
		ETGModConsole.Commands.AddGroup("switchpreset", (Action<string[]>)WindowManager.SwitchPreset);
		ETGModConsole.Commands.AddGroup("shortcutkey", (Action<string[]>)ShortcutKeyHandler.SetShortcutKey);
	}
}
public static class CoopViewPatches
{
	[HarmonyPatch(typeof(CameraController), "GetCoreCurrentBasePosition")]
	public class GetCoreCurrentBasePositionPatchClass
	{
		[HarmonyILManipulator]
		public static void GetCoreCurrentBasePositionPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchConvI4(x)
			}))
			{
				val.EmitCall<GetCoreCurrentBasePositionPatchClass>("GetCoreCurrentBasePositionPatchCall");
			}
		}

		private static int GetCoreCurrentBasePositionPatchCall(int orig)
		{
			return 1;
		}
	}

	[HarmonyPatch(typeof(CameraController), "GetCoreOffset")]
	public class GetCoreOffsetPatchClass
	{
		[HarmonyILManipulator]
		public static void GetCoreOffsetPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_009c: 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_014e: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			for (int i = 0; i < 2; i++)
			{
				if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_CurrentGameType")
				}))
				{
					val.EmitCall<GetCoreOffsetPatchClass>("GetCoreOffsetPatchCall_1");
				}
			}
			val.Index = 0;
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<Input>(x, "get_mousePosition")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<GetCoreOffsetPatchClass>("GetCoreOffsetPatchCall_2");
			}
			val.Index = 0;
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<BraveInput>(x, "GetInstanceForPlayer")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<GetCoreOffsetPatchClass>("GetCoreOffsetPatchCall_3");
			}
			val.Index = 0;
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_PrimaryPlayer")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<GetCoreOffsetPatchClass>("GetCoreOffsetPatchCall_4");
			}
			val.Index = 0;
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CameraController>(x, "OverrideZoomScale")
			}))
			{
				val.EmitCall<GetCoreOffsetPatchClass>("GetCoreOffsetPatchCall_5");
			}
		}

		private static bool GetCoreOffsetPatchCall_1(GameType orig)
		{
			return false;
		}

		private static Vector3 GetCoreOffsetPatchCall_2(Vector3 orig, CameraController self)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			if (OptionsManager.restrictMouseInputPort)
			{
				if (OptionsManager.currentPlayerOneMousePort == 0)
				{
					return (!self.m_player.IsPrimaryPlayer) ? Vector2Extensions.ToVector3ZUp(RawInputHandler.secondMousePosition, 0f) : orig;
				}
				return (!self.m_player.IsPrimaryPlayer) ? orig : Vector2Extensions.ToVector3ZUp(RawInputHandler.secondMousePosition, 0f);
			}
			return orig;
		}

		private static int GetCoreOffsetPatchCall_3(int orig, CameraController self)
		{
			if ((Object)(object)self.m_player == (Object)(object)GameManager.Instance.PrimaryPlayer)
			{
				return 0;
			}
			return 1;
		}

		private static PlayerController GetCoreOffsetPatchCall_4(PlayerController orig, CameraController self)
		{
			return self.m_player;
		}

		private static CameraController GetCoreOffsetPatchCall_5(CameraController orig)
		{
			if ((Object)(object)ViewController.camera != (Object)null && (Object)(object)orig == (Object)(object)ViewController.cameraController)
			{
				return GameManager.Instance.MainCameraController;
			}
			return orig;
		}
	}

	[HarmonyPatch(typeof(PlayerController), "ReinitializeMovementRestrictors")]
	public class ReinitializeMovementRestrictorsPatchClass
	{
		[HarmonyPrefix]
		public static bool ReinitializeMovementRestrictorsPrefix()
		{
			return false;
		}
	}

	[HarmonyPatch(typeof(PlayerController), "InitializeCallbacks")]
	public class InitializeCallbacksPatchClass
	{
		[HarmonyILManipulator]
		public static void InitializeCallbacksPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			for (int i = 0; i < 2; i++)
			{
				if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchNewobj<MovementRestrictorDelegate>(x)
				}))
				{
					val.EmitCall<InitializeCallbacksPatchClass>("InitializeCallbacksPatchCall");
				}
			}
		}

		private static Delegate InitializeCallbacksPatchCall(Delegate orig)
		{
			return null;
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class get_UseMouseAimPatchClass
	{
		[HarmonyILManipulator]
		public static void get_UseMouseAimPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<BraveInput>(x, "GetInstanceForPlayer")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<get_UseMouseAimPatchClass>("get_UseMouseAimPatchCall");
			}
		}

		private static int get_UseMouseAimPatchCall(int orig, CameraController self)
		{
			if ((Object)(object)self.m_player == (Object)(object)GameManager.Instance.PrimaryPlayer)
			{
				return 0;
			}
			return 1;
		}
	}

	[HarmonyPatch(typeof(PlayerController), "DetermineAimPointInWorld")]
	public class DetermineAimPointInWorldPatchClass
	{
		[HarmonyILManipulator]
		public static void DetermineAimPointInWorldPatch(ILContext ctx)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			ILCursor crs = new ILCursor(ctx);
			if (crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Component>(x, "GetComponent")
			}))
			{
				crs.Emit(OpCodes.Ldarg_0);
				crs.EmitCall<DetermineAimPointInWorldPatchClass>("DetermineAimPointInWorldPatchCall_1");
			}
			crs.Index = 0;
			if (TheNthTime(() => crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_MainCameraController")
			}), 2))
			{
				crs.Emit(OpCodes.Ldarg_0);
				crs.EmitCall<DetermineAimPointInWorldPatchClass>("DetermineAimPointInWorldPatchCall_2");
			}
		}

		private static Camera DetermineAimPointInWorldPatchCall_1(Camera orig, PlayerController self)
		{
			return ViewController.GetCameraForPlayer(self, orig);
		}

		private static CameraController DetermineAimPointInWorldPatchCall_2(CameraController orig, PlayerController self)
		{
			return ViewController.GetCameraControllerForPlayer(self, orig);
		}
	}

	[HarmonyPatch(typeof(PlayerController), "LateUpdate")]
	public class PlayerControllerLateUpdatePatchClass
	{
		[HarmonyILManipulator]
		public static void PlayerControllerLateUpdatePatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			while (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_MainCameraController")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<PlayerControllerLateUpdatePatchClass>("PlayerControllerLateUpdatePatchCall");
			}
		}

		private static CameraController PlayerControllerLateUpdatePatchCall(CameraController orig, PlayerController self)
		{
			return ViewController.GetCameraControllerForPlayer(self, orig);
		}
	}

	[HarmonyPatch(typeof(Pixelator), "FadeToBlack")]
	public class FadeToBlackPatchClass
	{
		[HarmonyPostfix]
		private static void FadeToBlackPostfix(Pixelator __instance, float duration, bool reverse = false, float holdTime = 0f)
		{
			if ((Object)(object)__instance == (Object)(object)Pixelator.Instance && (Object)(object)ViewController.cameraPixelator != (Object)null)
			{
				Orig_FadeToBlack(ViewController.cameraPixelator, duration, reverse, holdTime);
			}
		}

		private static void Orig_FadeToBlack(Pixelator self, float duration, bool reverse = false, float holdTime = 0f)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (reverse || self.fade != 0f)
			{
				self.m_fadeLocked = true;
				((MonoBehaviour)self).StartCoroutine(self.FadeToColor_CR(duration, Color.black, reverse, holdTime));
			}
		}
	}

	[HarmonyPatch(typeof(Pixelator), "FadeToColor")]
	public class FadeToColorPatchClass
	{
		[HarmonyPostfix]
		private static void FadeToColorPostfix(Pixelator __instance, float duration, Color c, bool reverse = false, float holdTime = 0f)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance == (Object)(object)Pixelator.Instance && (Object)(object)ViewController.cameraPixelator != (Object)null)
			{
				Orig_FadeToColor(ViewController.cameraPixelator, duration, c, reverse, holdTime);
			}
		}

		private static void Orig_FadeToColor(Pixelator self, float duration, Color c, bool reverse = false, float holdTime = 0f)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (!self.m_fadeLocked)
			{
				((MonoBehaviour)self).StartCoroutine(self.FadeToColor_CR(duration, c, reverse, holdTime));
			}
		}
	}

	[HarmonyPatch(typeof(CameraController), "AddFocusPoint", new Type[] { typeof(GameObject) })]
	public class AddFocusPointPatchClass
	{
		[HarmonyPostfix]
		private static void AddFocusPointPostfix(CameraController __instance, GameObject go)
		{
			if ((Object)(object)__instance == (Object)(object)GameManager.Instance.MainCameraController && (Object)(object)ViewController.camera != (Object)null)
			{
				Orig_AddFocusPoint(ViewController.cameraController, go);
			}
		}

		private static void Orig_AddFocusPoint(CameraController self, GameObject go)
		{
			if (!self.m_focusObjects.Contains((Object)(object)go))
			{
				self.m_focusObjects.Add((Object)(object)go);
			}
		}
	}

	[HarmonyPatch(typeof(CameraController), "SetZoomScaleImmediate")]
	public class SetZoomScaleImmediatePatchClass
	{
		[HarmonyPostfix]
		private static void SetZoomScaleImmediatePostfix(CameraController __instance, float zoomScale)
		{
			if ((Object)(object)__instance == (Object)(object)GameManager.Instance.MainCameraController && (Object)(object)ViewController.camera != (Object)null)
			{
				Orig_SetZoomScaleImmediate();
			}
		}

		private static void Orig_SetZoomScaleImmediate()
		{
			if ((Object)(object)ViewController.cameraPixelator != (Object)null)
			{
				CameraController originalCameraController = ViewController.originalCameraController;
				ViewController.cameraPixelator.NUM_MACRO_PIXELS_HORIZONTAL = (int)dfNumberExtensions.Quantize((float)BraveCameraUtility.H_PIXELS / originalCameraController.CurrentZoomScale, 2f);
				ViewController.cameraPixelator.NUM_MACRO_PIXELS_VERTICAL = (int)dfNumberExtensions.Quantize((float)BraveCameraUtility.V_PIXELS / originalCameraController.CurrentZoomScale, 2f);
			}
		}
	}

	[HarmonyPatch(typeof(CameraController), "RemoveFocusPoint", new Type[] { typeof(GameObject) })]
	public class RemoveFocusPointPatchClass
	{
		[HarmonyPostfix]
		private static void RemoveFocusPointPostfix(CameraController __instance, GameObject go)
		{
			if ((Object)(object)__instance == (Object)(object)GameManager.Instance.MainCameraController && (Object)(object)ViewController.camera != (Object)null)
			{
				Orig_RemoveFocusPoint(ViewController.cameraController, go);
			}
		}

		private static void Orig_RemoveFocusPoint(CameraController self, GameObject go)
		{
			self.m_focusObjects.Remove((Object)(object)go);
		}
	}

	[HarmonyPatch(typeof(CameraController), "SetManualControl")]
	public class SetManualControlPatchClass
	{
		[HarmonyPostfix]
		private static void SetManualControlPostfix(CameraController __instance, bool manualControl, bool shouldLerp = true)
		{
			if ((Object)(object)__instance == (Object)(object)GameManager.Instance.MainCameraController && (Object)(object)ViewController.camera != (Object)null)
			{
				Orig_SetManualControl(ViewController.cameraController, manualControl, shouldLerp);
			}
		}

		private static void Orig_SetManualControl(CameraController self, bool manualControl, bool shouldLerp = true)
		{
			self.m_manualControl = manualControl;
			if (self.m_manualControl)
			{
				self.m_isLerpingToManualControl = shouldLerp;
			}
			else
			{
				self.m_isRecoveringFromManualControl = shouldLerp;
			}
		}
	}

	[HarmonyPatch(typeof(CameraController), "DoContinuousScreenShake")]
	public class DoContinuousScreenShakePatchClass
	{
		[HarmonyPostfix]
		private static void DoContinuousScreenShakePostfix(CameraController __instance, ScreenShakeSettings shakesettings, Component source, bool isPlayerGun = false)
		{
			if ((Object)(object)__instance == (Object)(object)GameManager.Instance.MainCameraController && (Object)(object)ViewController.camera != (Object)null)
			{
				Orig_DoContinuousScreenShake(ViewController.cameraController, shakesettings, source, isPlayerGun);
			}
		}

		private static void Orig_DoContinuousScreenShake(CameraController self, ScreenShakeSettings shakesettings, Component source, bool isPlayerGun = false)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Invalid comparison between Unknown and I4
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Invalid comparison between Unknown and I4
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			float num = shakesettings.magnitude;
			if ((int)GameManager.Instance.CurrentGameType == 1 && GameManager.Options.CoopScreenShakeReduction)
			{
				num *= 0.3f;
			}
			if (isPlayerGun)
			{
				num *= 0.75f;
			}
			bool flag = (int)shakesettings.vibrationType > 0;
			if ((int)shakesettings.vibrationType == 20)
			{
				BraveInput.DoVibrationForAllPlayers(shakesettings.simpleVibrationTime, shakesettings.simpleVibrationStrength);
				flag = false;
			}
			IEnumerator enumerator = self.HandleContinuousScreenShake(num, shakesettings.speed, shakesettings.direction, source, flag);
			if (self.continuousShakeMap.ContainsKey(source))
			{
				Debug.LogWarning((object)("Overwriting previous screen shake for " + (object)source), (Object)(object)source);
				self.StopContinuousScreenShake(source);
			}
			self.continuousShakeMap.Add(source, enumerator);
			self.activeContinuousShakes.Add(enumerator);
		}
	}

	[HarmonyPatch(typeof(CameraController), "DoScreenShake", new Type[]
	{
		typeof(ScreenShakeSettings),
		typeof(Vector2?),
		typeof(bool)
	})]
	public class DoScreenShakePatchClass_1
	{
		[HarmonyPostfix]
		private static void DoScreenShakePostfix(CameraController __instance, ScreenShakeSettings shakesettings, Vector2? shakeOrigin, bool isPlayerGun = false)
		{
			if ((Object)(object)__instance == (Object)(object)GameManager.Instance.MainCameraController && (Object)(object)ViewController.camera != (Object)null)
			{
				Orig_DoScreenShake(ViewController.cameraController, shakesettings, shakeOrigin, isPlayerGun);
			}
		}

		private static void Orig_DoScreenShake(CameraController self, ScreenShakeSettings shakesettings, Vector2? shakeOrigin, bool isPlayerGun = false)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Invalid comparison between Unknown and I4
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Invalid comparison between Unknown and I4
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			float num = shakesettings.magnitude;
			if ((int)GameManager.Instance.CurrentGameType == 1 && GameManager.Options.CoopScreenShakeReduction)
			{
				num *= 0.3f;
			}
			if (isPlayerGun)
			{
				num *= 0.75f;
			}
			bool flag = (int)shakesettings.vibrationType > 0;
			if ((int)shakesettings.vibrationType == 20)
			{
				BraveInput.DoVibrationForAllPlayers(shakesettings.simpleVibrationTime, shakesettings.simpleVibrationStrength);
				flag = false;
			}
			((MonoBehaviour)self).StartCoroutine(self.HandleScreenShake(num, shakesettings.speed, shakesettings.time, shakesettings.falloff, shakesettings.direction, shakeOrigin, flag));
		}
	}

	[HarmonyPatch(typeof(CameraController), "DoScreenShake", new Type[]
	{
		typeof(float),
		typeof(float),
		typeof(float),
		typeof(float),
		typeof(Vector2?)
	})]
	public class DoScreenShakePatchClass_2
	{
		[HarmonyPostfix]
		private static void DoScreenShakePostfix(CameraController __instance, float magnitude, float shakeSpeed, float time, float falloffTime, Vector2? shakeOrigin)
		{
			if ((Object)(object)__instance == (Object)(object)GameManager.Instance.MainCameraController && (Object)(object)ViewController.camera != (Object)null)
			{
				Orig_DoScreenShake(ViewController.cameraController, magnitude, shakeSpeed, time, falloffTime, shakeOrigin);
			}
		}

		private static void Orig_DoScreenShake(CameraController self, float magnitude, float shakeSpeed, float time, float falloffTime, Vector2? shakeOrigin)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Invalid comparison between Unknown and I4
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			float num = magnitude;
			if ((int)GameManager.Instance.CurrentGameType == 1 && GameManager.Options.CoopScreenShakeReduction)
			{
				num *= 0.3f;
			}
			((MonoBehaviour)self).StartCoroutine(self.HandleScreenShake(num, shakeSpeed, time, falloffTime, Vector2.zero, shakeOrigin, true));
		}
	}

	[HarmonyPatch(typeof(CameraController), "StopContinuousScreenShake")]
	public class StopContinuousScreenShakePatchClass
	{
		[HarmonyPostfix]
		private static void StopContinuousScreenShakePostfix(CameraController __instance, Component source)
		{
			if ((Object)(object)__instance == (Object)(object)GameManager.Instance.MainCameraController && (Object)(object)ViewController.camera != (Object)null)
			{
				Orig_StopContinuousScreenShake(ViewController.cameraController, source);
			}
		}

		private static void Orig_StopContinuousScreenShake(CameraController self, Component source)
		{
			if (self.continuousShakeMap.ContainsKey(source))
			{
				IEnumerator enumerator = self.continuousShakeMap[source];
				self.m_terminateNextContinuousScreenShake = true;
				enumerator.MoveNext();
				self.continuousShakeMap.Remove(source);
				self.activeContinuousShakes.Remove(enumerator);
			}
		}
	}

	[HarmonyPatch(typeof(CameraController), "GetAimContribution")]
	public class GetAimContributionPatchClass
	{
		[HarmonyILManipulator]
		public static void GetAimContributionPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CameraController>(x, "OverrideZoomScale")
			}))
			{
				val.EmitCall<GetAimContributionPatchClass>("GetAimContributionPatchCall");
			}
		}

		private static CameraController GetAimContributionPatchCall(CameraController orig)
		{
			if ((Object)(object)ViewController.camera != (Object)null && (Object)(object)orig == (Object)(object)ViewController.cameraController)
			{
				return GameManager.Instance.MainCameraController;
			}
			return orig;
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class IsCurrentlyZoomIntermediatePatchClass
	{
		[HarmonyILManipulator]
		public static void IsCurrentlyZoomIntermediatePatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CameraController>(x, "CurrentZoomScale")
			}))
			{
				val.EmitCall<IsCurrentlyZoomIntermediatePatchClass>("IsCurrentlyZoomIntermediatePatchCall");
			}
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CameraController>(x, "OverrideZoomScale")
			}))
			{
				val.EmitCall<IsCurrentlyZoomIntermediatePatchClass>("IsCurrentlyZoomIntermediatePatchCall");
			}
		}

		private static CameraController IsCurrentlyZoomIntermediatePatchCall(CameraController orig)
		{
			if ((Object)(object)ViewController.camera != (Object)null && (Object)(object)orig == (Object)(object)ViewController.cameraController)
			{
				return GameManager.Instance.MainCameraController;
			}
			return orig;
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class LockToRoomPatchClass
	{
		[HarmonyILManipulator]
		public static void LockToRoomPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.Match(x, OpCodes.Ldfld)
			}))
			{
				val.EmitCall<LockToRoomPatchClass>("LockToRoomPatchCall");
			}
		}

		private static CameraController LockToRoomPatchCall(CameraController orig)
		{
			if ((Object)(object)ViewController.camera != (Object)null && (Object)(object)orig == (Object)(object)ViewController.cameraController)
			{
				return GameManager.Instance.MainCameraController;
			}
			return orig;
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class PitRespawnPatchClass
	{
		[HarmonyILManipulator]
		public static void PitRespawnPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			while (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_MainCameraController")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<PitRespawnPatchClass>("PitRespawnPatchCall");
			}
		}

		private static CameraController PitRespawnPatchCall(CameraController orig, object selfObject)
		{
			PlayerController fieldInEnumerator = GetFieldInEnumerator<PlayerController>(selfObject, "this");
			return ViewController.GetCameraControllerForPlayer(fieldInEnumerator, orig);
		}
	}

	[HarmonyPatch(typeof(CameraController), "LateUpdate")]
	public class CameraControllerLateUpdatePatchClass
	{
		internal static bool mainCameraUpdated;

		internal static bool secondCameraUpdated;

		[HarmonyILManipulator]
		public static void CameraControllerLateUpdatePatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			while (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<Pixelator>(x, "get_Instance")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<CameraControllerLateUpdatePatchClass>("CameraControllerLateUpdatePatchCall_1");
			}
			val.Index = 0;
			for (int i = 0; i < 2; i++)
			{
				if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCall<Camera>(x, "get_main")
				}))
				{
					val.Emit(OpCodes.Ldarg_0);
					val.EmitCall<CameraControllerLateUpdatePatchClass>("CameraControllerLateUpdatePatchCall_2");
				}
			}
			val.Index = 0;
			while (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CameraController>(x, "CurrentZoomScale")
			}))
			{
				val.EmitCall<CameraControllerLateUpdatePatchClass>("CameraControllerLateUpdatePatchCall_3");
				int index = val.Index;
				val.Index = index + 1;
			}
			val.Index = 0;
			while (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CameraController>(x, "OverrideZoomScale")
			}))
			{
				val.EmitCall<CameraControllerLateUpdatePatchClass>("CameraControllerLateUpdatePatchCall_3");
				int index = val.Index;
				val.Index = index + 1;
			}
			val.Index = 0;
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CameraController>(x, "OverridePosition")
			}))
			{
				val.EmitCall<CameraControllerLateUpdatePatchClass>("CameraControllerLateUpdatePatchCall_4");
			}
		}

		private static Pixelator CameraControllerLateUpdatePatchCall_1(Pixelator orig, CameraController self)
		{
			if ((Object)(object)ViewController.originalCameraController != (Object)null)
			{
				return ((Object)(object)self == (Object)(object)ViewController.originalCameraController) ? ViewController.originCameraPixelator : ViewController.cameraPixelator;
			}
			return orig;
		}

		private static Camera CameraControllerLateUpdatePatchCall_2(Camera orig, CameraController self)
		{
			return self.Camera;
		}

		private static CameraController CameraControllerLateUpdatePatchCall_3(CameraController orig)
		{
			if ((Object)(object)ViewController.camera != (Object)null && (Object)(object)orig == (Object)(object)ViewController.cameraController)
			{
				return GameManager.Instance.MainCameraController;
			}
			return orig;
		}

		private static CameraController CameraControllerLateUpdatePatchCall_4(CameraController orig)
		{
			if (bossKillCamIsRunning || bossIntroCamIsRunning || GameManager.Instance.IsPaused)
			{
				return orig;
			}
			return CameraControllerLateUpdatePatchCall_3(orig);
		}

		[HarmonyPrefix]
		public static void CameraControllerLateUpdatePrefix(CameraController __instance)
		{
			if ((Object)(object)ViewController.originalCameraController != (Object)null && (Object)(object)__instance == (Object)(object)ViewController.originalCameraController)
			{
				mainCameraUpdated = true;
			}
			else if ((Object)(object)ViewController.cameraController != (Object)null && (Object)(object)__instance == (Object)(object)ViewController.cameraController)
			{
				secondCameraUpdated = true;
			}
		}

		[HarmonyPostfix]
		public static void CameraControllerLateUpdatePostfix()
		{
			if (mainCameraUpdated && secondCameraUpdated)
			{
				if ((Object)(object)ViewController.mainCameraReloadBar != (Object)null)
				{
					ViewController.mainCameraReloadBar.OnMainCameraFinishedFrame();
				}
				if ((Object)(object)ViewController.mainCameraCoopReloadBar != (Object)null)
				{
					ViewController.mainCameraCoopReloadBar.OnMainCameraFinishedFrame();
				}
				if ((Object)(object)ViewController.secondCameraReloadBar != (Object)null)
				{
					Changed_OnMainCameraFinishedFrame(ViewController.secondCameraReloadBar);
				}
				if ((Object)(object)ViewController.secondCameraCoopReloadBar != (Object)null)
				{
					Changed_OnMainCameraFinishedFrame(ViewController.secondCameraCoopReloadBar);
				}
				if ((Object)(object)ViewController.secondCameraUiRoot != (Object)null)
				{
					Changed_UpdateReloadLabelsOnCameraFinishedFrame(ViewController.secondCameraUiRoot);
				}
				mainCameraUpdated = false;
				secondCameraUpdated = false;
			}
		}

		private static void Changed_OnMainCameraFinishedFrame(GameUIReloadBarController controller)
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: 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_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)controller.m_attachPlayer) && (((dfControl)controller.progressSlider).IsVisible || controller.AnyStatusBarVisible()))
			{
				Vector2 val = ((!((Object)(object)ViewController.camera == (Object)null) && !((Object)(object)ViewController.originalCamera == (Object)null)) ? Vector2.op_Implicit(controller.m_attachPlayer.LockedApproximateSpriteCenter - ((Component)ViewController.camera).transform.localPosition + ((Component)ViewController.originalCamera).transform.localPosition + controller.m_worldOffset) : Vector2.op_Implicit(controller.m_attachPlayer.LockedApproximateSpriteCenter + controller.m_worldOffset));
				Vector2 val2 = Vector2.op_Implicit(Vector3Extensions.WithZ(controller.ConvertWorldSpaces(Vector2.op_Implicit(val), controller.worldCamera, controller.uiCamera), 0f) + controller.m_screenOffset);
				((Component)controller.progressSlider).transform.position = Vector2.op_Implicit(val2);
				((Component)controller.progressSlider).transform.position = dfVectorExtensions.QuantizeFloor(((Component)controller.progressSlider).transform.position, ((dfControl)controller.progressSlider).PixelsToUnits() / (Pixelator.Instance.ScaleTileScale / Pixelator.Instance.CurrentTileScale));
				if ((Object)(object)controller.StatusBarPanel != (Object)null)
				{
					((Component)controller.StatusBarPanel).transform.position = ((Component)controller.progressSlider).transform.position - new Vector3(0f, -48f * ((dfControl)controller.progressSlider).PixelsToUnits(), 0f);
				}
			}
		}

		public static void Changed_UpdateReloadLabelsOnCameraFinishedFrame(GameUIRoot gameUI)
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Invalid comparison between Unknown and I4
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Invalid comparison between Unknown and I4
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			if (ViewController.secondCameraUiRoot.m_displayingReloadNeeded == null || (Object)(object)GameUIRoot.Instance == (Object)null || GameUIRoot.Instance.m_extantReloadLabels == null)
			{
				return;
			}
			Vector3 val3 = default(Vector3);
			for (int i = 0; i < GameUIRoot.Instance.m_displayingReloadNeeded.Count; i++)
			{
				if (GameUIRoot.Instance.m_displayingReloadNeeded[i] && i < gameUI.m_displayingReloadNeeded.Count)
				{
					PlayerController val = GameManager.Instance.PrimaryPlayer;
					if ((int)GameManager.Instance.CurrentGameType == 1 && i != 0)
					{
						val = GameManager.Instance.SecondaryPlayer;
					}
					dfControl val2 = (dfControl)(object)gameUI.m_extantReloadLabels[i];
					float num = 0.125f;
					if (((dfControl)gameUI.m_extantReloadLabels[i]).GetLocalizationKey() == "#RELOAD_FULL")
					{
						num = 0.1875f;
					}
					float num2 = 0f;
					if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((GameActor)val).CurrentGun) && (int)((GameActor)val).CurrentGun.Handedness == 4)
					{
						num2 += 0.5f;
					}
					((Vector3)(ref val3))..ctor(((BraveBehaviour)val).specRigidbody.UnitCenter.x - ((BraveBehaviour)val).transform.position.x + num, ((GameActor)val).SpriteDimensions.y + num2, 0f);
					if ((Object)(object)ViewController.camera != (Object)null && (Object)(object)ViewController.originalCamera != (Object)null)
					{
						val3 += -((Component)ViewController.camera).transform.localPosition + ((Component)ViewController.originalCamera).transform.localPosition;
					}
					Vector2 val4 = Vector2.op_Implicit(Vector3Extensions.WithZ(dfFollowObject.ConvertWorldSpaces(((BraveBehaviour)val).transform.position + val3, GameManager.Instance.MainCameraController.Camera, gameUI.Manager.RenderCamera), 0f));
					((Component)val2).transform.position = Vector2.op_Implicit(val4);
					((Component)val2).transform.position = dfVectorExtensions.QuantizeFloor(((Component)val2).transform.position, val2.PixelsToUnits() / (Pixelator.Instance.ScaleTileScale / Pixelator.Instance.CurrentTileScale));
				}
			}
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class Get_PixelatorInstancePatchPatchClass
	{
		[HarmonyILManipulator]
		public static void Get_PixelatorInstancePatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStsfld<Pixelator>(x, "m_instance")
			}))
			{
				val.EmitCall<Get_PixelatorInstancePatchPatchClass>("Get_PixelatorInstancePatchCall");
			}
		}

		private static Pixelator Get_PixelatorInstancePatchCall(Pixelator orig)
		{
			if ((Object)(object)ViewController.originCameraPixelator != (Object)null)
			{
				return ViewController.originCameraPixelator;
			}
			return orig;
		}
	}

	[HarmonyPatch(typeof(DemonWallDeathController), "OnBossDeath")]
	public class DemonWallDeathControllerOnBossDeathPatchClass
	{
		[HarmonyPrefix]
		public static bool DemonWallDeathControllerOnBossDeathPrefix(DemonWallDeathController __instance)
		{
			((Component)__instance).GetComponent<DemonWallController>().ModifyCamera(false);
			return true;
		}
	}

	[HarmonyPatch(typeof(HelicopterDeathController), "OnBossDeath")]
	public class HelicopterDeathControllerOnBossDeathPatchClass
	{
		[HarmonyPrefix]
		public static bool HelicopterDeathControllerOnBossDeathPrefix(HelicopterDeathController __instance)
		{
			((Component)__instance).GetComponent<HelicopterIntroDoer>().ModifyCamera(false);
			return true;
		}
	}

	[HarmonyPatch(typeof(BraveOptionsMenuItem), "Awake")]
	public class BraveOptionsMenuItemAwakePatchClass
	{
		[HarmonyILManipulator]
		public static void BraveOptionsMenuItemAwakePatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<dfControl>(x, "ResolutionChangedPostLayout")
			}))
			{
				val.EmitCall<BraveOptionsMenuItemAwakePatchClass>("BraveOptionsMenuItemAwakePatchCall");
			}
		}

		private static Action<dfControl, Vector3, Vector3> BraveOptionsMenuItemAwakePatchCall(Action<dfControl, Vector3, Vector3> orig)
		{
			return null;
		}
	}

	[HarmonyPatch(typeof(BraveOptionsMenuItem), "HandleScreenDataChanged")]
	public class HandleScreenDataChangedPatchClass
	{
		[HarmonyPostfix]
		public static void HandleScreenDataChangedPostfix()
		{
			((MonoBehaviour)GameManager.Instance).StartCoroutine(ViewController.OnUpdateResolution());
		}
	}

	[HarmonyPatch(typeof(TextBoxManager), "LateUpdate")]
	public class TextBoxManagerLateUpdatePatchClass
	{
		[HarmonyILManipulator]
		public static void TextBoxManagerLateUpdatePatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<Pixelator>(x, "DoFinalNonFadedLayer")
			}))
			{
				val.EmitCall<TextBoxManagerLateUpdatePatchClass>("TextBoxManagerLateUpdatePatchCall");
			}
		}

		private static bool TextBoxManagerLateUpdatePatchCall(bool orig)
		{
			return false;
		}
	}

	[HarmonyPatch(typeof(EndTimesNebulaController), "BecomeActive")]
	public class BecomeActivePatchClass
	{
		[HarmonyILManipulator]
		public static void BecomeActivePatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<Pixelator>(x, "get_Instance")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<BecomeActivePatchClass>("BecomeActivePatchCall");
			}
		}

		private static void BecomeActivePatchCall(EndTimesNebulaController self)
		{
			if ((Object)(object)ViewController.cameraPixelator != (Object)null)
			{
				ViewController.cameraPixelator.AdditionalBGCamera = self.NebulaCamera;
			}
		}
	}

	[HarmonyPatch(typeof(EndTimesNebulaController), "BecomeInactive")]
	public class BecomeInactivePatchClass
	{
		[HarmonyILManipulator]
		public static void BecomeInactivePatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<Pixelator>(x, "get_HasInstance")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<BecomeInactivePatchClass>("BecomeInactivePatchCall");
			}
		}

		private static void BecomeInactivePatchCall(EndTimesNebulaController self)
		{
			if ((Object)(object)ViewController.cameraPixelator != (Object)null && (Object)(object)ViewController.cameraPixelator.AdditionalBGCamera == (Object)(object)self.NebulaCamera)
			{
				ViewController.cameraPixelator.AdditionalBGCamera = null;
			}
		}
	}

	[HarmonyPatch(typeof(CameraController), "GetBoundedCameraPositionInRect")]
	public class GetBoundedCameraPositionInRectPatchClass
	{
		[HarmonyILManipulator]
		public static void GetBoundedCameraPositionInRectPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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)
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<Vector2>(x, "x")
			}))
			{
				val.Emit(OpCodes.Ldloc_1);
				val.Emit(OpCodes.Ldloc_2);
				val.EmitCall<GetBoundedCameraPositionInRectPatchClass>("GetBoundedCameraPositionInRectPatchCall_1");
			}
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchSub(x)
			}))
			{
				val.Emit(OpCodes.Ldloc_1);
				val.Emit(OpCodes.Ldloc_2);
				val.EmitCall<GetBoundedCameraPositionInRectPatchClass>("GetBoundedCameraPositionInRectPatchCall_2");
			}
		}

		private static float GetBoundedCameraPositionInRectPatchCall_1(float orig, Vector2 cameraBottomLeft, Vector2 cameraTopRight)
		{
			//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)
			//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)
			return (cameraTopRight.x + cameraBottomLeft.x) / 2f - (cameraTopRight.y - cameraBottomLeft.y) * 16f / 9f / 2f;
		}

		private static float GetBoundedCameraPositionInRectPatchCall_2(float orig, Vector2 cameraBottomLeft, Vector2 cameraTopRight)
		{
			//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 (cameraTopRight.y - cameraBottomLeft.y) * 16f / 9f;
		}
	}

	[HarmonyPatch(typeof(GameManager), "PauseRaw")]
	public class PauseRawPatchClass
	{
		[HarmonyILManipulator]
		public static void PauseRawPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<CameraController>(x, "OverridePosition")
			}))
			{
				val.EmitCall<PauseRawPatchClass>("PauseRawPatchCall");
			}
		}

		private static void PauseRawPatchCall()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ViewController.cameraController != (Object)null)
			{
				ViewController.cameraController.OverridePosition = ((BraveBehaviour)ViewController.cameraController).transform.position;
			}
		}
	}

	[HarmonyPatch(typeof(TalkDoerLite), "ShowText")]
	public class ShowTextPatchClass
	{
		[HarmonyPrefix]
		public static void ShowTextPrefix(TalkDoerLite __instance, ref Vector3 worldPosition, ref string text, ref bool isThoughtBox)
		{
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Invalid comparison between Unknown and I4
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Invalid comparison between Unknown and I4
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			if (!(((Object)__instance).name == "NPC_FoyerCharacter_Cultist(Clone)"))
			{
				return;
			}
			if (Display.displays.Length > 1 && Display.displays[1].active)
			{
				if ((int)GameManager.Options.CurrentLanguage == 11)
				{
					text = "  -- " + ShortcutKeyHandler.shortcutKeyString[0].Replace("[", "左方括号").Replace("]", "右方括号") + " : 切换成下一个窗口位置预设(共3个)。\n  -- " + ShortcutKeyHandler.shortcutKeyString[1].Replace("[", "左方括号").Replace("]", "右方括号") + " : 将第二窗口在全屏和窗口化之间切换。\n  -- " + ShortcutKeyHandler.shortcutKeyString[2].Replace("[", "左方括号").Replace("]", "右方括号") + " : 将第二窗口全屏显示在下一个显示器上。\n  -- " + ShortcutKeyHandler.shortcutKeyString[3].Replace("[", "左方括号").Replace("]", "右方括号") + " : 将主窗口在全屏和窗口化之间切换。\n  -- " + ShortcutKeyHandler.shortcutKeyString[4].Replace("[", "左方括号").Replace("]", "右方括号") + " : 将主窗口全屏显示在下一个显示器上。\n*相机或控制交换见选项。*】";
				}
				else
				{
					text = "  -- " + ShortcutKeyHandler.shortcutKeyString[0].Replace("[", "left_square_bracket").Replace("]", "right_square_bracket") + " :  Switch to the next window position preset (3 in total).\n  -- " + ShortcutKeyHandler.shortcutKeyString[1].Replace("[", "left_square_bracket").Replace("]", "right_square_bracket") + " :  Switch the second window between fullscreen and windowed mode.\n  -- " + ShortcutKeyHandler.shortcutKeyString[2].Replace("[", "left_square_bracket").Replace("]", "right_square_bracket") + " :  Fullscreen the second window on the next monitor.\n  -- " + ShortcutKeyHandler.shortcutKeyString[3].Replace("[", "left_square_bracket").Replace("]", "right_square_bracket") + " :  Switch the main window between fullscreen and windowed mode.\n  -- " + ShortcutKeyHandler.shortcutKeyString[4].Replace("[", "left_square_bracket").Replace("]", "right_square_bracket") + " :  Fullscreen the main window on the next monitor.\n*Swapping cameras or control devices is available in options.*";
				}
				worldPosition += new Vector3(2f, -6f, 0f);
			}
			else
			{
				if ((int)GameManager.Options.CurrentLanguage == 11)
				{
					text = "错误:未检测到第二显示器!\n请确保第二显示器连接,无论是物理显示器还是虚拟显示器(如Parsec-vdd)。\n同时确保第二显示器处于扩展模式(快捷键Win + P可以切换)。\n以上一切就绪后必须重新启动游戏!";
				}
				else
				{
					text = "Error: Second monitor not detected!\nPlease ensure that the second monitor is connected, whether it is a physical monitor or a virtual monitor (such as Parsec-vdd).\nAnd ensure that the second monitor is in extend mode (shortcut key Win + P can switch).\nAfter all of the above is ready, the game must be restarted!";
				}
				worldPosition += new Vector3(2f, -5f, 0f);
			}
			isThoughtBox = true;
		}
	}

	[HarmonyPatch(typeof(Minimap), "ToggleMinimap")]
	public class ToggleMinimapPatchClass
	{
		[HarmonyILManipulator]
		public static void ToggleMinimapPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<Pixelator>(x, "fade")
			}))
			{
				val.EmitCall<ToggleMinimapPatchClass>("ToggleMinimapPatchCall_1");
			}
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<Pixelator>(x, "fade")
			}))
			{
				val.EmitCall<ToggleMinimapPatchClass>("ToggleMinimapPatchCall_2");
			}
		}

		private static void ToggleMinimapPatchCall_1()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ViewController.cameraPixelator != (Object)null)
			{
				ViewController.cameraPixelator.FadeColor = Color.black;
				ViewController.cameraPixelator.fade = 0.3f;
			}
		}

		private static void ToggleMinimapPatchCall_2()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ViewController.cameraPixelator != (Object)null)
			{
				ViewController.cameraPixelator.FadeColor = Color.black;
				ViewController.cameraPixelator.fade = 1f;
			}
		}
	}

	[HarmonyPatch(typeof(Minimap), "ToggleMinimapRat")]
	public class ToggleMinimapRatPatchClass
	{
		[HarmonyILManipulator]
		public static void ToggleMinimapRatPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<Pixelator>(x, "fade")
			}))
			{
				val.EmitCall<ToggleMinimapRatPatchClass>("ToggleMinimapRatPatchCall_1");
			}
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<Pixelator>(x, "fade")
			}))
			{
				val.EmitCall<ToggleMinimapRatPatchClass>("ToggleMinimapRatPatchCall_2");
			}
		}

		private static void ToggleMinimapRatPatchCall_1()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ViewController.cameraPixelator != (Object)null)
			{
				ViewController.cameraPixelator.FadeColor = Color.black;
				ViewController.cameraPixelator.fade = 0.3f;
			}
		}

		private static void ToggleMinimapRatPatchCall_2()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ViewController.cameraPixelator != (Object)null)
			{
				ViewController.cameraPixelator.FadeColor = Color.black;
				ViewController.cameraPixelator.fade = 1f;
			}
		}
	}

	[HarmonyPatch(typeof(GameCursorController), "DrawCursor")]
	public class DrawCursorPatchClass
	{
		[HarmonyILManipulator]
		public static void DrawCursorPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<GameCursorController>(x, "get_showPlayerOneControllerCursor")
			}))
			{
				val.EmitCall<DrawCursorPatchClass>("DrawCursorPatchCall_1");
			}
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<GameCursorController>(x, "get_showPlayerTwoControllerCursor")
			}))
			{
				val.EmitCall<DrawCursorPatchClass>("DrawCursorPatchCall_2");
			}
		}

		private static bool DrawCursorPatchCall_1(bool orig)
		{
			return orig && (!((Object)(object)ViewController.originalCameraController != (Object)null) || OptionsManager.isPrimaryPlayerOnMainCamera);
		}

		private static bool DrawCursorPatchCall_2(bool orig)
		{
			return orig && (!((Object)(object)ViewController.originalCameraController != (Object)null) || !OptionsManager.isPrimaryPlayerOnMainCamera);
		}
	}

	[HarmonyPatch(typeof(BraveOptionsMenuItem), "DetermineAvailableOptions")]
	public class DetermineAvailableOptionsPatchClass
	{
		[HarmonyPrefix]
		public static void DetermineAvailableOptionsPrefix(BraveOptionsMenuItem __instance)
		{
			//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_0008: 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_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Invalid comparison between Unknown and I4
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Invalid comparison between Unknown and I4
			BraveOptionsOptionType optionType = __instance.optionType;
			BraveOptionsOptionType val = optionType;
			if ((int)val != 512)
			{
				if ((int)val == 513)
				{
					List<string> list = (((int)GameManager.Options.CurrentLanguage == 11) ? new List<string> { "主相机", "第二相机", "自动" } : new List<string> { "Main Camera", "Second Camera", "Auto" });
					__instance.labelOptions = list.ToArray();
				}
			}
			else
			{
				List<string> list2 = new List<string>
				{
					((int)GameManager.Options.CurrentLanguage == 11) ? "自动" : "Auto",
					"480 × 270",
					"960 × 540",
					"1440 × 810",
					"1920 × 1080",
					"2400 × 1350",
					"2880 × 1620"
				};
				__instance.labelOptions = list2.ToArray();
			}
		}
	}

	[HarmonyPatch(typeof(BraveOptionsMenuItem), "HandleLeftRightArrowValueChanged")]
	public class HandleLeftRightArrowValueChangedPatchClass
	{
		[HarmonyPostfix]
		public static void HandleLeftRightArrowValueChangedPostfix(BraveOptionsMenuItem __instance)
		{
			//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_0008: 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_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Invalid comparison between Unknown and I4
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Invalid comparison between Unknown and I4
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Invalid comparison between Unknown and I4
			BraveOptionsOptionType optionType = __instance.optionType;
			BraveOptionsOptionType val = optionType;
			if ((int)val <= 257)
			{
				if ((int)val != 256)
				{
					if ((int)val == 257)
					{
						((MonoBehaviour)GameManager.Instance).StartCoroutine(ViewController.UpdatePlayerAndCameraBindings());
						float playerOneMouseSensitivityMultiplier = RawInputHandler.playerOneMouseSensitivityMultiplier;
						RawInputHandler.playerOneMouseSensitivityMultiplier = RawInputHandler.playerTwoMouseSensitivityMultiplier;
						RawInputHandler.playerTwoMouseSensitivityMultiplier = playerOneMouseSensitivityMultiplier;
					}
				}
				else
				{
					((MonoBehaviour)GameManager.Instance).StartCoroutine(ViewController.UpdatePlayerAndCameraBindings());
				}
			}
			else if ((int)val != 512)
			{
				if ((int)val == 513)
				{
					((MonoBehaviour)GameManager.Instance).StartCoroutine(ViewController.UpdatePlayerAndCameraBindings());
					OptionsManager.playerOneCamera = __instance.m_selectedIndex;
					Debug.Log((object)$"Coop View: Player one camera option value set to {__instance.m_selectedIndex}");
				}
			}
			else
			{
				OptionsManager.secondWindowStartupResolution = __instance.m_selectedIndex;
				Debug.Log((object)$"Coop View: Second window startup resolution set to {__instance.m_selectedIndex}");
			}
		}
	}

	[HarmonyPatch(typeof(FullOptionsMenuController), "CloseAndApplyChanges")]
	public class CloseAndApplyChangesPatchClass
	{
		[HarmonyPostfix]
		public static void CloseAndApplyChangesPostfix()
		{
			CoopViewPreferences.SavePreferences();
		}
	}

	[HarmonyPatch(typeof(FullOptionsMenuController), "CloseAndRevertChanges")]
	public class CloseAndRevertChangesPatchClass
	{
		[HarmonyPostfix]
		public static void CloseAndRevertChangesPostfix()
		{
			CoopViewPreferences.SavePreferences();
		}
	}

	[HarmonyPatch(typeof(FullOptionsMenuController), "ToggleToPanel")]
	public class ToggleToPanelPatchClass
	{
		[HarmonyPostfix]
		public static void ToggleToPanelPostfix(FullOptionsMenuController __instance, dfScrollPanel targetPanel, bool doFocus)
		{
			if ((Object)(object)targetPanel == (Object)(object)__instance.TabVideo)
			{
				int i;
				for (i = 0; i < ((dfControl)targetPanel).Controls.Count && !((dfControl)targetPanel).Controls[i].CanFocus; i++)
				{
				}
				if (((dfControl)targetPanel).Controls.Count > 0 && i < ((dfControl)targetPanel).Controls.Count)
				{
					((Component)__instance.PrimaryCancelButton).GetComponent<UIKeyControls>().down = ((dfControl)targetPanel).Controls[i];
					((Component)__instance.PrimaryConfirmButton).GetComponent<UIKeyControls>().down = ((dfControl)targetPanel).Controls[i];
					((Component)__instance.PrimaryResetDefaultsButton).GetComponent<UIKeyControls>().down = ((dfControl)targetPanel).Controls[i];
					((Component)((dfControl)targetPanel).Controls[i]).GetComponent<BraveOptionsMenuItem>().up = (dfControl)(object)__instance.PrimaryConfirmButton;
					((dfControl)targetPanel).Controls[i].Focus(true);
				}
			}
		}
	}

	[HarmonyPatch(typeof(Camera), "ScreenPointToRay")]
	public class ScreenPointToRayPatchClass
	{
		[HarmonyPrefix]
		public static void ScreenPointToRayPrefix(Camera __instance, ref Vector3 position, ref Ray __result)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance == (Object)(object)ViewController.camera)
			{
				float x = position.x;
				Rect rect = ViewController.originalCamera.rect;
				float num = (x - ((Rect)(ref rect)).xMin * (float)Screen.width) * (float)WindowManager.referenceSecondWindowWidth / (float)ViewController.originalCamera.pixelWidth;
				float y = position.y;
				rect = ViewController.originalCamera.rect;
				float num2 = (y - ((Rect)(ref rect)).yMin * (float)Screen.height) * (float)WindowManager.referenceSecondWindowHeight / (float)ViewController.originalCamera.pixelHeight;
				float num3 = WindowManager.referenceSecondWindowWidth / 2;
				float num4 = num - (float)(WindowManager.referenceSecondWindowWidth / 2);
				rect = ViewController.originalCamera.rect;
				position.x = num3 + num4 * ((Rect)(ref rect)).height;
				float num5 = WindowManager.referenceSecondWindowHeight / 2;
				float num6 = num2 - (float)(WindowManager.referenceSecondWindowHeight / 2);
				rect = ViewController.originalCamera.rect;
				position.y = num5 + num6 * ((Rect)(ref rect)).height;
			}
		}
	}

	[HarmonyPatch(typeof(Camera), "ScreenToWorldPoint")]
	public class ScreenToWorldPointPatchClass
	{
		[HarmonyPrefix]
		public static void ScreenToWorldPointPrefix(Camera __instance, ref Vector3 position, ref Vector3 __result)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance == (Object)(object)ViewController.camera)
			{
				float x = position.x;
				Rect rect = ViewController.originalCamera.rect;
				float num = (x - ((Rect)(ref rect)).xMin * (float)Screen.width) * (float)WindowManager.referenceSecondWindowWidth / (float)ViewController.originalCamera.pixelWidth;
				float y = position.y;
				rect = ViewController.originalCamera.rect;
				float num2 = (y - ((Rect)(ref rect)).yMin * (float)Screen.height) * (float)WindowManager.referenceSecondWindowHeight / (float)ViewController.originalCamera.pixelHeight;
				float num3 = WindowManager.referenceSecondWindowWidth / 2;
				float num4 = num - (float)(WindowManager.referenceSecondWindowWidth / 2);
				rect = ViewController.originalCamera.rect;
				position.x = num3 + num4 * ((Rect)(ref rect)).width;
				float num5 = WindowManager.referenceSecondWindowHeight / 2;
				float num6 = num2 - (float)(WindowManager.referenceSecondWindowHeight / 2);
				rect = ViewController.originalCamera.rect;
				position.y = num5 + num6 * ((Rect)(ref rect)).height;
			}
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class HandleMetalGearGunSelectPatchClass
	{
		[HarmonyILManipulator]
		public static void HandleMetalGearGunSelectPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<Pixelator>(x, "fade")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<HandleMetalGearGunSelectPatchClass>("HandleMetalGearGunSelectPatchCall_1");
			}
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<Pixelator>(x, "fade")
			}))
			{
				val.EmitCall<HandleMetalGearGunSelectPatchClass>("HandleMetalGearGunSelectPatchCall_2");
			}
		}

		private static void HandleMetalGearGunSelectPatchCall_1(object selfObject)
		{
			float fieldInEnumerator = GetFieldInEnumerator<float>(selfObject, "totalTimeMetalGeared");
			if ((Object)(object)ViewController.cameraPixelator != (Object)null)
			{
				ViewController.cameraPixelator.fade = 1f - Mathf.Clamp01(fieldInEnumerator * 8f) * 0.5f;
			}
		}

		private static void HandleMetalGearGunSelectPatchCall_2()
		{
			if ((Object)(object)ViewController.cameraPixelator != (Object)null)
			{
				ViewController.cameraPixelator.fade = 1f;
			}
		}
	}

	[HarmonyPatch(typeof(BossKillCam), "TriggerSequence")]
	public class BossKillCamTriggerSequencePatchClass
	{
		[HarmonyPostfix]
		public static void TriggerSequencePostfix(BossKillCam __instance, SpeculativeRigidbody bossSRB)
		{
			//IL_0025: 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_0071: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			bossKillCamIsRunning = true;
			if ((Object)(object)ViewController.cameraController != (Object)null)
			{
				ViewController.cameraController.OverridePosition = ((BraveBehaviour)ViewController.cameraController).transform.position;
			}
			if ((Object)(object)__instance.m_projectile == (Object)null && Object.op_Implicit((Object)(object)ViewController.cameraController))
			{
				Vector2? overrideKillCamPos = ((BraveBehaviour)bossSRB).healthHaver.OverrideKillCamPos;
				Vector2 val = ((!overrideKillCamPos.HasValue) ? bossSRB.UnitCenter : overrideKillCamPos.Value);
				__instance.m_suppressContinuousBulletDestruction = ((BraveBehaviour)bossSRB).healthHaver.SuppressContinuousKillCamBulletDestruction;
				CutsceneMotion val2 = new CutsceneMotion(((BraveBehaviour)ViewController.cameraController).transform, (Vector2?)val, Vector2.Distance(Vector3Extensions.XY(((BraveBehaviour)ViewController.cameraController).transform.position), val) / __instance.trackToBossTime, 0f);
				val2.camera = ViewController.cameraController;
				__instance.activeMotions.Add(val2);
			}
		}
	}

	[HarmonyPatch(typeof(BossKillCam), "EndSequence")]
	public class BossKillCamEndSequencePatchClass
	{
		[HarmonyPostfix]
		public static void EndSequencePostfix()
		{
			bossKillCamIsRunning = false;
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class Set_IsLoadingLevelPatchClass
	{
		[HarmonyPrefix]
		public static void Set_IsLoadingLevelPrefix(bool value)
		{
			if (value)
			{
				bossKillCamIsRunning = false;
				bossIntroCamIsRunning = false;
				CameraControllerLateUpdatePatchClass.mainCameraUpdated = false;
				CameraControllerLateUpdatePatchClass.secondCameraUpdated = false;
				ViewController.additionalRenderMaterials.Clear();
			}
		}
	}

	[HarmonyPatch(typeof(BossKillCam), "InvariantUpdate")]
	public class BossKillCamInvariantUpdatePatchClass
	{
		[HarmonyILManipulator]
		public static void BossKillCamInvariantUpdatePatch(ILContext ctx)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			ILCursor crs = new ILCursor(ctx);
			if (crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_MainCameraController")
			}))
			{
				crs.Emit(OpCodes.Ldarg_0);
				crs.EmitCall<BossKillCamInvariantUpdatePatchClass>("BossKillCamInvariantUpdatePatchCall_1");
			}
			if (crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_MainCameraController")
			}))
			{
				crs.Emit(OpCodes.Ldarg_0);
				crs.EmitCall<BossKillCamInvariantUpdatePatchClass>("BossKillCamInvariantUpdatePatchCall_2");
			}
			if (crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_MainCameraController")
			}))
			{
				crs.Emit(OpCodes.Ldarg_0);
				crs.EmitCall<BossKillCamInvariantUpdatePatchClass>("BossKillCamInvariantUpdatePatchCall_3");
			}
			crs.Index = 0;
			if (TheNthTime(() => crs.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<GatlingGullIntroDoer>(x, "m_currentPhase")
			}), 3))
			{
				crs.Emit(OpCodes.Ldarg_0);
				crs.Emit(OpCodes.Ldloc_S, (byte)5);
				crs.EmitCall<BossKillCamInvariantUpdatePatchClass>("BossKillCamInvariantUpdatePatchCall_4");
			}
			if (TheNthTime(() => crs.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<GatlingGullIntroDoer>(x, "m_phaseComplete")
			}), 2))
			{
				crs.Emit(OpCodes.Ldarg_0);
				crs.Emit(OpCodes.Ldloc_S, (byte)5);
				crs.EmitCall<BossKillCamInvariantUpdatePatchClass>("BossKillCamInvariantUpdatePatchCall_5");
			}
		}

		private static CameraController BossKillCamInvariantUpdatePatchCall_1(CameraController orig, BossKillCam self)
		{
			return self.m_camera;
		}

		private static void BossKillCamInvariantUpdatePatchCall_2(BossKillCam self)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ViewController.cameraController != (Object)null)
			{
				ViewController.cameraController.OverridePosition = Vector2.op_Implicit(self.m_bossRigidbody.GetUnitCenter((ColliderType)2));
			}
		}

		private static void BossKillCamInvariantUpdatePatchCall_3(BossKillCam self)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0064: Expected O, but got Unknown
			if ((Object)(object)ViewController.cameraController != (Object)null)
			{
				ViewController.cameraController.ForceUpdateControllerCameraState((ControllerCameraState)0);
				Vector2 coreCurrentBasePosition = ViewController.cameraController.GetCoreCurrentBasePosition();
				CutsceneMotion val = new CutsceneMotion(((BraveBehaviour)ViewController.cameraController).transform, (Vector2?)coreCurrentBasePosition, Vector2.Distance(Vector3Extensions.XY(((BraveBehaviour)ViewController.cameraController).transform.position), coreCurrentBasePosition) / self.returnToPlayerTime, 0f);
				val.camera = ViewController.cameraController;
				self.activeMotions.Add(val);
			}
		}

		private static int BossKillCamInvariantUpdatePatchCall_4(int orig, CutsceneMotion cutsceneMotion, BossKillCam self)
		{
			if ((Object)(object)ViewController.cameraController != (Object)null && (Object)(object)cutsceneMotion.camera == (Object)(object)ViewController.cameraController)
			{
				return self.m_currentPhase;
			}
			return orig;
		}

		private static bool BossKillCamInvariantUpdatePatchCall_5(bool orig, CutsceneMotion cutsceneMotion, BossKillCam self)
		{
			if ((Object)(object)ViewController.cameraController != (Object)null && (Object)(object)cutsceneMotion.camera == (Object)(object)ViewController.cameraController)
			{
				return self.m_phaseComplete;
			}
			return orig;
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class GenericIntroDoerFrameDelayedTriggerSequencePatchClass
	{
		[HarmonyILManipulator]
		public static void GenericIntroDoerFrameDelayedTriggerSequencePatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<GenericIntroDoer>(x, "m_isRunning")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<GenericIntroDoerFrameDelayedTriggerSequencePatchClass>("GenericIntroDoerFrameDelayedTriggerSequencePatchCall");
			}
		}

		private static void GenericIntroDoerFrameDelayedTriggerSequencePatchCall(object selfObject)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			GenericIntroDoer fieldInEnumerator = GetFieldInEnumerator<GenericIntroDoer>(selfObject, "this");
			if ((Object)(object)fieldInEnumerator.m_specificIntroDoer == (Object)null)
			{
				bossIntroCamIsRunning = true;
				if ((Object)(object)ViewController.cameraController != (Object)null)
				{
					ViewController.cameraController.OverridePosition = ((BraveBehaviour)ViewController.cameraController).transform.position;
				}
			}
		}
	}

	[HarmonyPatch(typeof(GenericIntroDoer), "EndSequence")]
	public class GenericIntroDoerEndSequencePatchClass
	{
		[HarmonyPostfix]
		public static void GenericIntroDoerEndSequencePostfix()
		{
			bossIntroCamIsRunning = false;
		}
	}

	[HarmonyPatch(typeof(GenericIntroDoer), "InvariantUpdate")]
	public class GenericIntroDoerInvariantUpdatePatchClass
	{
		[HarmonyILManipulator]
		public static void GenericIntroDoerInvariantUpdatePatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: 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_00e3: 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_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_MainCameraController")
			}))
			{
				val.Emit(OpCodes.Ldloc_2);
				val.EmitCall<GenericIntroDoerInvariantUpdatePatchClass>("GenericIntroDoerInvariantUpdatePatchCall_1");
			}
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_MainCameraController")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<GenericIntroDoerInvariantUpdatePatchClass>("GenericIntroDoerInvariantUpdatePatchCall_2");
			}
			val.Index = 0;
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, "System.Collections.Generic.List`1<CutsceneMotion>", "Add")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<GenericIntroDoerInvariantUpdatePatchClass>("GenericIntroDoerInvariantUpdatePatchCall_3");
			}
			val.Index = 0;
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<GatlingGullIntroDoer>(x, "m_currentPhase")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldloc_2);
				val.EmitCall<GenericIntroDoerInvariantUpdatePatchClass>("GenericIntroDoerInvariantUpdatePatchCall_4");
			}
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<GatlingGullIntroDoer>(x, "m_phaseComplete")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldloc_2);
				val.EmitCall<GenericIntroDoerInvariantUpdatePatchClass>("GenericIntroDoerInvariantUpdatePatchCall_4");
			}
		}

		private static CameraController GenericIntroDoerInvariantUpdatePatchCall_1(CameraController orig, CutsceneMotion cutsceneMotion)
		{
			return cutsceneMotion.camera;
		}

		private static void GenericIntroDoerInvariantUpdatePatchCall_2(GenericIntroDoer self)
		{
			//IL_003d: 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_00a0: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)ViewController.cameraController != (Object)null))
			{
				return;
			}
			ViewController.cameraController.ForceUpdateControllerCameraState((ControllerCameraState)1);
			if ((Object)(object)self.m_specificIntroDoer != (Object)null)
			{
				bossIntroCamIsRunning = true;
			}
			Vector2? val = ViewController.cameraController.GetIdealCameraPosition();
			if (Object.op_Implicit((Object)(object)self.m_specificIntroDoer))
			{
				Vector2? overrideOutroPosition = self.m_specificIntroDoer.OverrideOutroPosition;
				if (overrideOutroPosition.HasValue)
				{
					val = overrideOutroPosition.Value;
				}
			}
			CutsceneMotion val2 = new CutsceneMotion(((BraveBehaviour)ViewController.cameraController).transform, val, self.cameraMoveSpeed, 0f);
			val2.camera = ViewController.cameraController;
			self.activeMotions.Add(val2);
		}

		private static void GenericIntroDoerInvariantUpdatePatchCall_3(GenericIntroDoer self)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			if ((Object)(object)ViewController.cameraController != (Object)null)
			{
				CutsceneMotion val = new CutsceneMotion(((BraveBehaviour)ViewController.cameraController).transform, (Vector2?)self.BossCenter, self.cameraMoveSpeed, 0f);
				val.camera = ViewController.cameraController;
				self.activeMotions.Add(val);
			}
		}

		private static Phase GenericIntroDoerInvariantUpdatePatchCall_4(Phase orig, CutsceneMotion cutsceneMotion, GenericIntroDoer self)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ViewController.cameraController != (Object)null && (Object)(object)cutsceneMotion.camera == (Object)(object)ViewController.cameraController)
			{
				return self.m_currentPhase;
			}
			return orig;
		}

		private static bool GenericIntroDoerInvariantUpdatePatchCall_5(bool orig, CutsceneMotion cutsceneMotion, GenericIntroDoer self)
		{
			if ((Object)(object)ViewController.cameraController != (Object)null && (Object)(object)cutsceneMotion.camera == (Object)(object)ViewController.cameraController)
			{
				return self.m_phaseComplete;
			}
			return orig;
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class GatlingGullIntroDoerFrameDelayedTriggerSequencePatchClass
	{
		[HarmonyILManipulator]
		public static void FrameDelayedTriggerSequencePatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<GatlingGullIntroDoer>(x, "m_isRunning")
			}))
			{
				val.EmitCall<GatlingGullIntroDoerFrameDelayedTriggerSequencePatchClass>("GatlingGullIntroDoerFrameDelayedTriggerSequencePatchCall");
			}
		}

		private static void GatlingGullIntroDoerFrameDelayedTriggerSequencePatchCall()
		{
			//IL_0025: 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)
			bossIntroCamIsRunning = true;
			if ((Object)(object)ViewController.cameraController != (Object)null)
			{
				ViewController.cameraController.OverridePosition = ((BraveBehaviour)ViewController.cameraController).transform.position;
			}
		}
	}

	[HarmonyPatch(typeof(GatlingGullIntroDoer), "InvariantUpdate")]
	public class GatlingGullIntroDoerInvariantUpdatePatchClass
	{
		[HarmonyILManipulator]
		public static void GatlingGullIntroDoerInvariantUpdatePatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: 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_00e3: 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_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_MainCameraController")
			}))
			{
				val.Emit(OpCodes.Ldloc_2);
				val.EmitCall<GatlingGullIntroDoerInvariantUpdatePatchClass>("GatlingGullIntroDoerInvariantUpdatePatchCall_1");
			}
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_MainCameraController")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<GatlingGullIntroDoerInvariantUpdatePatchClass>("GatlingGullIntroDoerInvariantUpdatePatchCall_2");
			}
			val.Index = 0;
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, "System.Collections.Generic.List`1<CutsceneMotion>", "Add")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<GatlingGullIntroDoerInvariantUpdatePatchClass>("GatlingGullIntroDoerInvariantUpdatePatchCall_3");
			}
			val.Index = 0;
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<GatlingGullIntroDoer>(x, "m_currentPhase")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldloc_2);
				val.EmitCall<GatlingGullIntroDoerInvariantUpdatePatchClass>("GatlingGullIntroDoerInvariantUpdatePatchCall_4");
			}
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<GatlingGullIntroDoer>(x, "m_phaseComplete")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldloc_2);
				val.EmitCall<GatlingGullIntroDoerInvariantUpdatePatchClass>("GatlingGullIntroDoerInvariantUpdatePatchCall_5");
			}
		}

		private static CameraController GatlingGullIntroDoerInvariantUpdatePatchCall_1(CameraController orig, CutsceneMotion cutsceneMotion)
		{
			return cutsceneMotion.camera;
		}

		private static void GatlingGullIntroDoerInvariantUpdatePatchCall_2(GatlingGullIntroDoer self)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			if ((Object)(object)ViewController.cameraController != (Object)null)
			{
				ViewController.cameraController.ForceUpdateControllerCameraState((ControllerCameraState)1);
				Vector2 idealCameraPosition = ViewController.cameraController.GetIdealCameraPosition();
				CutsceneMotion val = new CutsceneMotion(((BraveBehaviour)ViewController.cameraController).transform, (Vector2?)idealCameraPosition, self.cameraMoveSpeed, 0f);
				val.camera = ViewController.cameraController;
				self.activeMotions.Add(val);
			}
		}

		private static void GatlingGullIntroDoerInvariantUpdatePatchCall_3(GatlingGullIntroDoer self)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			if ((Object)(object)ViewController.cameraController != (Object)null)
			{
				CutsceneMotion val = new CutsceneMotion(((BraveBehaviour)ViewController.cameraController).transform, (Vector2?)((BraveBehaviour)self).specRigidbody.UnitCenter, self.cameraMoveSpeed, 0f);
				val.camera = ViewController.cameraController;
				self.activeMotions.Add(val);
			}
		}

		private static int GatlingGullIntroDoerInvariantUpdatePatchCall_4(int orig, CutsceneMotion cutsceneMotion, GatlingGullIntroDoer self)
		{
			if ((Object)(object)ViewController.cameraController != (Object)null && (Object)(object)cutsceneMotion.camera == (Object)(object)ViewController.cameraController)
			{
				return self.m_currentPhase;
			}
			return orig;
		}

		private static bool GatlingGullIntroDoerInvariantUpdatePatchCall_5(bool orig, CutsceneMotion cutsceneMotion, GatlingGullIntroDoer self)
		{
			if ((Object)(object)ViewController.cameraController != (Object)null && (Object)(object)cutsceneMotion.camera == (Object)(object)ViewController.cameraController)
			{
				return self.m_phaseComplete;
			}
			return orig;
		}
	}

	[HarmonyPatch(typeof(GatlingGullIntroDoer), "EndSequence")]
	public class GatlingGullIntroDoerEndSequencePatchClass
	{
		[HarmonyPostfix]
		public static void GatlingGullIntroDoerEndSequencePostfix()
		{
			bossIntroCamIsRunning = false;
		}
	}

	[HarmonyPatch(typeof(Gun), "DoScreenShake")]
	public class GunDoScreenShakePatchClass
	{
		[HarmonyILManipulator]
		public static void GunDoScreenShakePatch(ILContext ctx)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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)
			ILCursor crs = new ILCursor(ctx);
			if (TheNthTime(() => crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_MainCameraController")
			}), 2))
			{
				crs.Emit(OpCodes.Ldarg_0);
				crs.EmitCall<GunDoScreenShakePatchClass>("GunDoScreenShakePatchCall_1");
			}
			crs.Index = 0;
			if (crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<CameraController>(x, "DoGunScreenShake")
			}))
			{
				crs.Emit(OpCodes.Ldarg_0);
				crs.Emit(OpCodes.Ldloc_0);
				crs.EmitCall<GunDoScreenShakePatchClass>("GunDoScreenShakePatchCall_2");
			}
		}

		private static CameraController GunDoScreenShakePatchCall_1(CameraController orig, Gun self)
		{
			if ((Object)(object)ViewController.cameraController != (Object)null && (Object)/*isinst with value type is only supported in some contexts*/ != (Object)null)
			{
				GameActor owner = self.m_owner;
				return ViewController.GetCameraControllerForPlayer((PlayerController)(object)((owner is PlayerController) ? owner : null));
			}
			return orig;
		}

		private static void GunDoScreenShakePatchCall_2(Gun self, Vector2 dir)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ViewController.cameraController != (Object)null && (Object)/*isinst with value type is only supported in some contexts*/ == (Object)null)
			{
				? val = ViewController.cameraController;
				ScreenShakeSettings gunScreenShake = self.gunScreenShake;
				GameActor owner = self.m_owner;
				((CameraController)val).DoGunScreenShake(gunScreenShake, dir, (Vector2?)null, (PlayerController)(object)((owner is PlayerController) ? owner : null));
			}
		}
	}

	[HarmonyPatch(typeof(PlayerActionSet), "Load")]
	public class LoadPatchClass
	{
		[HarmonyPostfix]
		public static void LoadPostfix()
		{
			((MonoBehaviour)GameManager.Instance).StartCoroutine(ViewController.UpdatePlayerAndCameraBindings());
		}
	}

	[HarmonyPatch(typeof(GameManager), "HandleDeviceShift")]
	public class HandleDeviceShiftPatchClass
	{
		[HarmonyPostfix]
		public static void HandleDeviceShiftPostfix()
		{
			((MonoBehaviour)GameManager.Instance).StartCoroutine(ViewController.UpdatePlayerAndCameraBindings());
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class Get_GameUIRootInstancePatchClass
	{
		[HarmonyILManipulator]
		public static void Get_GameUIRootInstancePatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStsfld<GameUIRoot>(x, "m_root")
			}))
			{
				val.EmitCall<Get_GameUIRootInstancePatchClass>("Get_GameUIRootInstancePatchCall");
			}
		}

		private static GameUIRoot Get_GameUIRootInstancePatchCall(GameUIRoot orig)
		{
			if ((Object)(object)ViewController.uiRoot == (Object)null)
			{
				GameObject val = GameObject.Find("UI Root");
				if ((Object)(object)val != (Object)null)
				{
					return val.GetComponent<GameUIRoot>();
				}
				return null;
			}
			return ViewController.uiRoot;
		}
	}

	[HarmonyPatch(typeof(GameUIRoot), "InvariantUpdate")]
	public class InvariantUpdatePatchClass
	{
		[HarmonyILManipulator]
		public static void Get_GameUIRootInstancePatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_IsLoadingLevel")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<InvariantUpdatePatchClass>("InvariantUpdatePatchClassPatchCall");
			}
		}

		private static bool InvariantUpdatePatchClassPatchCall(bool orig,