Decompiled source of Coop View v0.9.9
CoopView.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; 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", "0.9.9")] public class CoopViewModule : BaseUnityPlugin { public enum BraveOptionsOptionType { SECOND_WINDOW_STARTING_RESOLUTION = 0x200 } public const string GUID = "kleirof.etg.coopview"; public const string NAME = "Coop View"; public const string VERSION = "0.9.9"; public const string TEXT_COLOR = "#CCFF33"; private static GameObject canvasObject; private static Canvas canvas; private static GameObject rawImageObject; private static RawImage rawImage; private static RenderTexture renderTexture; private static GameObject uiRawImageObject; private static RawImage uiRawImage; public static RenderTexture uiRenderTexture; private static GameObject maskRawImageObject; private static RawImage maskRawImage; public static RenderTexture maskRenderTexture; public static Pixelator originCameraPixelator; public static Pixelator cameraPixelator; private static GameObject originalCameraObject; private static GameObject cameraObject; private static GameObject minimapObject; public static Camera weirdoUiCamera; public static Camera camera; public static Camera originalCamera; private static Camera uiCamera; private static Camera minimapUiCamera; public static Camera minimapCamera; private static Camera ammoCamera; public static CameraController cameraController; public static CameraController originalCameraController; private static GameUIRoot uiRoot; private static GameUIReloadBarController reloadBarController; private static GameUIReloadBarController coopReloadBarController; private static dfGUIManager uiManager; private static GameCursorController gameCursorController; public static BraveOptionsMenuItem resolutionOptionsMenuItem; public static BraveOptionsMenuItem screenModeOptionsMenuItem; private static Rect rectFullscreen; private static Rect rectSmall; private bool clearable = false; public static int secondWindowPixelWidth; public static int secondWindowPixelHeight; public static bool secondWindowActive = false; private static bool isInitializingOptions = false; private static GameObject videoOptionsScrollablePanelObject; private static GameObject optionsMenuPanelDaveObject; private static GameObject secondWindowStartupResolutionSelectorPanelObject; private static GameObject secondWindowResolutionTipObject; public static int secondWindowStartupResolution = 0; public static AssetBundle coopViewAssets; private static Shader maskShader; private static Material maskMaterial; public static bool waitingForRestoringCaption = true; public void Start() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Expected O, but got Unknown try { CoopViewPreferences.LoadPreferences(); } catch (Exception ex) { ETGModConsole.Log((object)("Failed to load Coop View Preferences." + ex), false); } if (Display.displays.Length > 1) { Display.displays[1].Activate(WindowManager.startupWidth, WindowManager.startupHeight, 0); WindowManager.SetSecondWindowText(); string[] args = new string[1] { "2" }; WindowManager.SwitchSecondWindowToFullscreen(args); WindowManager.referenceSecondWindowWidth = WindowManager.startupWidth; WindowManager.referenceSecondWindowHeight = WindowManager.startupHeight; secondWindowActive = true; } else { Debug.LogError((object)"Target monitor not found."); } ETGModMainBehaviour.WaitForGameManagerStart((Action<GameManager>)GMStart); canvasObject = new GameObject("Overlay Canvas"); Object.DontDestroyOnLoad((Object)(object)canvasObject); canvas = canvasObject.AddComponent<Canvas>(); CanvasScaler val = canvasObject.AddComponent<CanvasScaler>(); GraphicRaycaster val2 = canvasObject.AddComponent<GraphicRaycaster>(); canvas.renderMode = (RenderMode)0; canvas.targetDisplay = 1; canvas.sortingOrder = 1; Harmony.CreateAndPatchAll(typeof(CoopViewPatches), (string)null); WindowManager.InitWindowHook(); ShortcutKeyHandler.InitMessageHandler(); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("CoopView.coopview_assets")) { coopViewAssets = AssetBundle.LoadFromStream(stream); } maskShader = coopViewAssets.LoadAsset<Shader>("MaskRenderTextureRegion"); maskMaterial = new Material(maskShader); ChangeMouseSensitivityMultipliers(); } 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 v0.9.9 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 void Update() { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Invalid comparison between Unknown and I4 //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_0638: Unknown result type (might be due to invalid IL or missing references) //IL_0642: Expected O, but got Unknown //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0668: Expected O, but got Unknown //IL_06ce: Unknown result type (might be due to invalid IL or missing references) //IL_06db: Unknown result type (might be due to invalid IL or missing references) //IL_0701: Unknown result type (might be due to invalid IL or missing references) //IL_0706: Unknown result type (might be due to invalid IL or missing references) //IL_071c: Unknown result type (might be due to invalid IL or missing references) //IL_0721: Unknown result type (might be due to invalid IL or missing references) //IL_072e: Unknown result type (might be due to invalid IL or missing references) //IL_0738: Expected O, but got Unknown //IL_0754: Unknown result type (might be due to invalid IL or missing references) //IL_075e: Expected O, but got Unknown //IL_07ab: Unknown result type (might be due to invalid IL or missing references) //IL_07b0: Unknown result type (might be due to invalid IL or missing references) //IL_07d5: Unknown result type (might be due to invalid IL or missing references) //IL_07da: Unknown result type (might be due to invalid IL or missing references) //IL_07f4: Unknown result type (might be due to invalid IL or missing references) //IL_0801: Unknown result type (might be due to invalid IL or missing references) //IL_0827: Unknown result type (might be due to invalid IL or missing references) //IL_082c: Unknown result type (might be due to invalid IL or missing references) //IL_0842: Unknown result type (might be due to invalid IL or missing references) //IL_0847: Unknown result type (might be due to invalid IL or missing references) //IL_0854: Unknown result type (might be due to invalid IL or missing references) //IL_085e: Expected O, but got Unknown //IL_087a: Unknown result type (might be due to invalid IL or missing references) //IL_0884: Expected O, but got Unknown //IL_08d1: Unknown result type (might be due to invalid IL or missing references) //IL_08d6: Unknown result type (might be due to invalid IL or missing references) //IL_08fb: Unknown result type (might be due to invalid IL or missing references) //IL_0900: Unknown result type (might be due to invalid IL or missing references) //IL_091a: Unknown result type (might be due to invalid IL or missing references) //IL_0927: Unknown result type (might be due to invalid IL or missing references) //IL_0947: Unknown result type (might be due to invalid IL or missing references) //IL_094c: Unknown result type (might be due to invalid IL or missing references) //IL_095c: Unknown result type (might be due to invalid IL or missing references) //IL_0961: Unknown result type (might be due to invalid IL or missing references) //IL_0996: Unknown result type (might be due to invalid IL or missing references) if (waitingForRestoringCaption) { WindowManager.RestoreMainWindowCaption(); string[] args = new string[0]; WindowManager.SwitchMainWindowToWindowed(args); waitingForRestoringCaption = false; } if ((Object)(object)videoOptionsScrollablePanelObject == (Object)null && !isInitializingOptions) { ((MonoBehaviour)this).StartCoroutine(InitializeOptions()); } if ((Object)(object)resolutionOptionsMenuItem == (Object)null) { GameObject val = GameObject.Find("ResolutionArrowSelectorPanelWithInfoBox"); if ((Object)(object)val != (Object)null) { resolutionOptionsMenuItem = val.GetComponent<BraveOptionsMenuItem>(); } } if ((Object)(object)screenModeOptionsMenuItem == (Object)null) { GameObject val2 = GameObject.Find("ScreenModeArrowSelectorPanel"); if ((Object)(object)val2 != (Object)null) { screenModeOptionsMenuItem = val2.GetComponentInChildren<BraveOptionsMenuItem>(); } } if (GameManager.HasInstance && (int)GameManager.Instance.CurrentGameType == 1) { if ((Object)(object)uiRenderTexture != (Object)null) { RenderTexture.active = uiRenderTexture; GL.Clear(true, true, (GameManager.Instance.IsPaused || GameManager.Instance.IsLoadingLevel || AmmonomiconController.Instance.IsOpen) ? Color.black : Color.clear); RenderTexture.active = null; } if (GameManager.Instance.IsLoadingLevel && (Object)(object)weirdoUiCamera == (Object)null) { GameObject val3 = GameObject.Find("weirdo ui camera"); if ((Object)(object)val3 != (Object)null) { weirdoUiCamera = val3.GetComponent<Camera>(); clearable = true; } } if ((Object)(object)uiManager == (Object)null) { GameObject val4 = GameObject.Find("UI Root"); if ((Object)(object)val4 != (Object)null) { uiRoot = val4.GetComponent<GameUIRoot>(); uiManager = val4.GetComponent<dfGUIManager>(); gameCursorController = val4.GetComponent<GameCursorController>(); clearable = true; } } if ((Object)(object)reloadBarController == (Object)null) { GameObject val5 = GameObject.Find("ReloadSlider"); if ((Object)(object)val5 != (Object)null) { reloadBarController = val5.GetComponent<GameUIReloadBarController>(); clearable = true; } } if ((Object)(object)coopReloadBarController == (Object)null) { GameObject val6 = GameObject.Find("ReloadSlider Coop"); if ((Object)(object)val6 != (Object)null) { coopReloadBarController = val6.GetComponent<GameUIReloadBarController>(); clearable = true; } } if ((Object)(object)originalCamera == (Object)null) { originalCameraObject = GameObject.Find("Main Camera"); if ((Object)(object)originalCameraObject != (Object)null) { originalCamera = originalCameraObject.GetComponentInChildren<Camera>(); originCameraPixelator = ((Component)originalCamera).GetComponent<Pixelator>(); originalCameraController = ((Component)originalCamera).GetComponent<CameraController>(); if (secondWindowActive) { if (0.5625f < (float)WindowManager.SecondWindowHeight / (float)WindowManager.SecondWindowWidth) { secondWindowPixelWidth = WindowManager.SecondWindowWidth; secondWindowPixelHeight = (int)((float)WindowManager.SecondWindowWidth * 9f / 16f); } else { secondWindowPixelWidth = (int)((float)WindowManager.SecondWindowHeight * 16f / 9f); secondWindowPixelHeight = WindowManager.SecondWindowHeight; } } clearable = true; } } else if ((Object)(object)camera == (Object)null) { cameraObject = Object.Instantiate<GameObject>(originalCameraObject); if ((Object)(object)cameraObject != (Object)null) { camera = cameraObject.GetComponent<Camera>(); ((Object)camera).name = "Camera Copy"; camera.targetTexture = renderTexture; cameraController = ((Component)camera).GetComponent<CameraController>(); cameraPixelator = ((Component)camera).GetComponent<Pixelator>(); clearable = true; } } if ((Object)(object)uiCamera == (Object)null) { GameObject val7 = GameObject.Find("UI Root"); if ((Object)(object)val7 != (Object)null) { uiCamera = val7.GetComponentInChildren<Camera>(); Minimap.Instance.ToggleMinimap(false, false); clearable = true; } } if ((Object)(object)minimapUiCamera == (Object)null) { GameObject val8 = GameObject.Find("Minimap UI Root"); if ((Object)(object)val8 != (Object)null) { minimapUiCamera = val8.GetComponentInChildren<Camera>(); clearable = true; } } if ((Object)(object)minimapCamera == (Object)null) { minimapObject = GameObject.Find("_Minimap"); if ((Object)(object)minimapObject != (Object)null) { GameObject gameObject = ((Component)minimapObject.transform.Find("Minimap Camera")).gameObject; minimapCamera = minimapObject.GetComponentInChildren<Camera>(); if ((Object)(object)originalCamera != (Object)null) { rectFullscreen = originalCamera.rect; rectSmall = new Rect(0.25f * ((Rect)(ref rectFullscreen)).width + 0.5f, 0.1625f * ((Rect)(ref rectFullscreen)).height + 0.5f, 0.25f * ((Rect)(ref rectFullscreen)).width, 0.25f * ((Rect)(ref rectFullscreen)).height); } clearable = true; } } if ((Object)(object)ammoCamera == (Object)null) { GameObject val9 = GameObject.Find("Ammonomicon Root(Clone)"); if ((Object)(object)val9 != (Object)null) { ammoCamera = val9.GetComponentInChildren<Camera>(); clearable = true; } } if (secondWindowActive && ((Object)(object)rawImageObject == (Object)null || (Object)(object)uiRawImageObject == (Object)null)) { if (0.5625f < (float)WindowManager.SecondWindowHeight / (float)WindowManager.SecondWindowWidth) { secondWindowPixelWidth = WindowManager.SecondWindowWidth; secondWindowPixelHeight = (int)((float)WindowManager.SecondWindowWidth * 9f / 16f); } else { secondWindowPixelWidth = (int)((float)WindowManager.SecondWindowHeight * 16f / 9f); secondWindowPixelHeight = WindowManager.SecondWindowHeight; } renderTexture = new RenderTexture(WindowManager.startupWidth, WindowManager.startupHeight, 0, (RenderTextureFormat)0); renderTexture.enableRandomWrite = true; renderTexture.Create(); rawImageObject = new GameObject("rawImage"); Object.DontDestroyOnLoad((Object)(object)rawImageObject); rawImageObject.transform.SetParent(canvasObject.transform); rawImage = rawImageObject.AddComponent<RawImage>(); RectTransform component = rawImageObject.GetComponent<RectTransform>(); component.sizeDelta = new Vector2((float)(secondWindowPixelWidth * WindowManager.referenceSecondWindowWidth / WindowManager.SecondWindowWidth), (float)(secondWindowPixelHeight * WindowManager.referenceSecondWindowHeight / WindowManager.SecondWindowHeight)); component.anchoredPosition = Vector2.zero; rawImage.texture = (Texture)(object)renderTexture; float num = secondWindowPixelWidth; Rect rect = originalCamera.rect; int num2 = (int)(num / ((Rect)(ref rect)).width); float num3 = secondWindowPixelHeight; rect = originalCamera.rect; uiRenderTexture = new RenderTexture(num2, (int)(num3 / ((Rect)(ref rect)).height), 0, (RenderTextureFormat)0); uiRenderTexture.enableRandomWrite = true; uiRenderTexture.Create(); uiRawImageObject = new GameObject("uiRawImage"); Object.DontDestroyOnLoad((Object)(object)uiRawImageObject); uiRawImageObject.transform.SetParent(canvasObject.transform); uiRawImage = uiRawImageObject.AddComponent<RawImage>(); RectTransform component2 = uiRawImageObject.GetComponent<RectTransform>(); float num4 = secondWindowPixelWidth; rect = originalCamera.rect; float num5 = (int)(num4 / ((Rect)(ref rect)).width * (float)WindowManager.referenceSecondWindowWidth / (float)WindowManager.SecondWindowWidth); float num6 = secondWindowPixelHeight; rect = originalCamera.rect; component2.sizeDelta = new Vector2(num5, (float)(int)(num6 / ((Rect)(ref rect)).height * (float)WindowManager.referenceSecondWindowHeight / (float)WindowManager.SecondWindowHeight)); component2.anchoredPosition = Vector2.zero; uiRawImage.texture = (Texture)(object)uiRenderTexture; float num7 = secondWindowPixelWidth; rect = originalCamera.rect; int num8 = (int)(num7 / ((Rect)(ref rect)).width); float num9 = secondWindowPixelHeight; rect = originalCamera.rect; maskRenderTexture = new RenderTexture(num8, (int)(num9 / ((Rect)(ref rect)).height), 0, (RenderTextureFormat)0); maskRenderTexture.enableRandomWrite = true; maskRenderTexture.Create(); maskRawImageObject = new GameObject("maskRawImage"); Object.DontDestroyOnLoad((Object)(object)maskRawImageObject); maskRawImageObject.transform.SetParent(canvasObject.transform); maskRawImage = maskRawImageObject.AddComponent<RawImage>(); RectTransform component3 = maskRawImageObject.GetComponent<RectTransform>(); float num10 = secondWindowPixelWidth; rect = originalCamera.rect; float num11 = (int)(num10 / ((Rect)(ref rect)).width * (float)WindowManager.referenceSecondWindowWidth / (float)WindowManager.SecondWindowWidth); float num12 = secondWindowPixelHeight; rect = originalCamera.rect; component3.sizeDelta = new Vector2(num11, (float)(int)(num12 / ((Rect)(ref rect)).height * (float)WindowManager.referenceSecondWindowHeight / (float)WindowManager.SecondWindowHeight)); component3.anchoredPosition = Vector2.zero; maskRawImage.texture = (Texture)(object)maskRenderTexture; rect = Camera.main.rect; float width = ((Rect)(ref rect)).width; rect = Camera.main.rect; float height = ((Rect)(ref rect)).height; maskMaterial.SetVector("_MaskRect", new Vector4((1f - width) / 2f, (1f - height) / 2f, width, height)); Graphics.Blit((Texture)null, maskRenderTexture, maskMaterial); clearable = true; Debug.Log((object)"Second camera initialized."); } } else if (clearable) { clearable = false; ((MonoBehaviour)this).StartCoroutine(ClearCaches()); } } public void LateUpdate() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) if (!GameManager.HasInstance || (int)GameManager.Instance.CurrentGameType != 1) { return; } if (!GameManager.Instance.IsLoadingLevel) { if ((Object)(object)camera != (Object)null) { cameraPixelator.SetOcclusionDirty(); originCameraPixelator.SetOcclusionDirty(); } if ((GameManager.Instance.IsPaused || GameManager.Instance.IsLoadingLevel || AmmonomiconController.Instance.IsOpen) && (Object)(object)uiRenderTexture != (Object)null) { RenderTexture.active = uiRenderTexture; GL.Clear(true, true, Color.black); RenderTexture.active = null; } if ((Object)(object)minimapCamera != (Object)null && Minimap.HasInstance && !Minimap.Instance.m_isFaded && !GameManager.IsBossIntro) { Rect rect = minimapCamera.rect; minimapCamera.rect = (Minimap.Instance.IsFullscreen ? rectFullscreen : rectSmall); minimapCamera.targetTexture = uiRenderTexture; minimapCamera.Render(); minimapCamera.targetTexture = null; minimapCamera.rect = rect; } if ((Object)(object)uiCamera != (Object)null) { if ((Object)(object)uiRoot != (Object)null && (Object)(object)uiManager != (Object)null && (Object)(object)coopReloadBarController != (Object)null && (Object)(object)reloadBarController != (Object)null && !GameManager.Instance.IsPaused) { Changed_UpdateReloadLabelsOnCameraFinishedFrame(uiRoot); Changed_OnMainCameraFinishedFrame(coopReloadBarController); Changed_OnMainCameraFinishedFrame(reloadBarController); if (uiManager.isDirty && uiManager.suspendCount <= 0) { Changed_Render(uiManager); dfMaterialCache.Reset(); uiManager.updateDrawCalls(); } } uiCamera.targetTexture = uiRenderTexture; uiCamera.Render(); uiCamera.targetTexture = null; } if ((Object)(object)minimapUiCamera != (Object)null && Minimap.HasInstance && Minimap.Instance.IsFullscreen) { minimapUiCamera.targetTexture = uiRenderTexture; minimapUiCamera.Render(); minimapUiCamera.targetTexture = null; } if ((Object)(object)ammoCamera != (Object)null && AmmonomiconController.HasInstance && AmmonomiconController.Instance.IsOpen) { ammoCamera.targetTexture = uiRenderTexture; ammoCamera.Render(); ammoCamera.targetTexture = null; } } else if ((Object)(object)weirdoUiCamera != (Object)null) { weirdoUiCamera.targetTexture = uiRenderTexture; weirdoUiCamera.Render(); weirdoUiCamera.targetTexture = null; } DrawCursor(uiRenderTexture); } public IEnumerator ClearCaches() { RenderTexture.active = renderTexture; GL.Clear(true, true, Color.black); RenderTexture.active = null; RenderTexture.active = uiRenderTexture; GL.Clear(true, true, Color.black); RenderTexture.active = null; yield return null; if ((Object)(object)originalCameraController != (Object)null) { originalCameraController = null; } if ((Object)(object)cameraController != (Object)null) { cameraController = null; } if ((Object)(object)originalCamera != (Object)null) { originalCamera = null; } if ((Object)(object)camera != (Object)null) { Object.Destroy((Object)(object)camera); camera = null; } if ((Object)(object)uiCamera != (Object)null) { uiCamera = null; } if ((Object)(object)weirdoUiCamera != (Object)null) { weirdoUiCamera = null; } if ((Object)(object)minimapUiCamera != (Object)null) { minimapUiCamera = null; } if ((Object)(object)minimapCamera != (Object)null) { minimapCamera = null; } if ((Object)(object)ammoCamera != (Object)null) { ammoCamera = null; } if ((Object)(object)originCameraPixelator != (Object)null) { originCameraPixelator = null; } if ((Object)(object)cameraPixelator != (Object)null) { cameraPixelator = null; } if ((Object)(object)coopReloadBarController != (Object)null) { coopReloadBarController = null; } if ((Object)(object)reloadBarController != (Object)null) { reloadBarController = null; } if ((Object)(object)originalCameraObject != (Object)null) { originalCameraObject = null; } if ((Object)(object)cameraObject != (Object)null) { cameraObject = null; } if ((Object)(object)uiRoot != (Object)null) { uiRoot = null; } if ((Object)(object)uiManager != (Object)null) { uiManager = null; } if ((Object)(object)renderTexture != (Object)null) { renderTexture.Release(); renderTexture = null; } if ((Object)(object)uiRenderTexture != (Object)null) { uiRenderTexture.Release(); uiRenderTexture = null; } if ((Object)(object)rawImageObject != (Object)null) { Object.Destroy((Object)(object)rawImageObject); rawImageObject = null; } if ((Object)(object)uiRawImageObject != (Object)null) { Object.Destroy((Object)(object)uiRawImageObject); uiRawImageObject = null; } Debug.Log((object)"Second camera released."); } public static IEnumerator UpdateResolution() { while (GameManager.Instance.IsLoadingLevel) { yield return null; } if (!(WindowManager.SecondWindow == IntPtr.Zero) || Object.op_Implicit((Object)(object)camera)) { if ((Object)(object)uiRawImageObject != (Object)null) { uiRawImage.texture = null; ((Graphic)uiRawImage).color = Color.black; } yield return null; if ((int)GameManager.Options.CurrentPreferredFullscreenMode == 2) { IntPtr window = BraveOptionsMenuItem.ResolutionManagerWin.Window; int style = (int)WindowsResolutionManager.GetWindowLongPtr(window, -16); WindowsResolutionManager.SetWindowLongPtr(window, -16, style | 0xC00000 | 0x40000 | 0x80000 | 0x20000 | 0x10000); WindowsResolutionManager.SetWindowPos(window, -2, 0, 0, 0, 0, 35); } if ((Object)(object)renderTexture != (Object)null) { RenderTexture.active = renderTexture; GL.Clear(true, true, Color.black); RenderTexture.active = null; } yield return null; if (0.5625f < (float)WindowManager.SecondWindowHeight / (float)WindowManager.SecondWindowWidth) { secondWindowPixelWidth = WindowManager.SecondWindowWidth; secondWindowPixelHeight = (int)((float)WindowManager.SecondWindowWidth * 9f / 16f); } else { secondWindowPixelWidth = (int)((float)WindowManager.SecondWindowHeight * 16f / 9f); secondWindowPixelHeight = WindowManager.SecondWindowHeight; } if ((Object)(object)rawImageObject != (Object)null) { RectTransform rectTransform = rawImageObject.GetComponent<RectTransform>(); rectTransform.sizeDelta = new Vector2((float)(secondWindowPixelWidth * WindowManager.referenceSecondWindowWidth / WindowManager.SecondWindowWidth), (float)(secondWindowPixelHeight * WindowManager.referenceSecondWindowHeight / WindowManager.SecondWindowHeight)); } if ((Object)(object)uiRawImageObject != (Object)null) { uiRenderTexture.Release(); float num = WindowManager.referenceSecondWindowWidth; Rect rect = originalCamera.rect; int num2 = (int)(num / ((Rect)(ref rect)).width); float num3 = WindowManager.referenceSecondWindowHeight; rect = originalCamera.rect; uiRenderTexture = new RenderTexture(num2, (int)(num3 / ((Rect)(ref rect)).height), 0, (RenderTextureFormat)0); uiRenderTexture.enableRandomWrite = true; uiRenderTexture.Create(); RectTransform uiRectTransform = uiRawImageObject.GetComponent<RectTransform>(); float num4 = secondWindowPixelWidth; rect = originalCamera.rect; float num5 = (int)(num4 / ((Rect)(ref rect)).width * (float)WindowManager.referenceSecondWindowWidth / (float)WindowManager.SecondWindowWidth); float num6 = secondWindowPixelHeight; rect = originalCamera.rect; uiRectTransform.sizeDelta = new Vector2(num5, (float)(int)(num6 / ((Rect)(ref rect)).height * (float)WindowManager.referenceSecondWindowHeight / (float)WindowManager.SecondWindowHeight)); uiRawImage.texture = null; ((Graphic)uiRawImage).color = Color.black; yield return null; ((Graphic)uiRawImage).color = Color.white; uiRawImage.texture = (Texture)(object)uiRenderTexture; maskRenderTexture.Release(); float num7 = WindowManager.referenceSecondWindowWidth; rect = originalCamera.rect; int num8 = (int)(num7 / ((Rect)(ref rect)).width); float num9 = WindowManager.referenceSecondWindowHeight; rect = originalCamera.rect; maskRenderTexture = new RenderTexture(num8, (int)(num9 / ((Rect)(ref rect)).height), 0, (RenderTextureFormat)0); maskRenderTexture.enableRandomWrite = true; maskRenderTexture.Create(); RectTransform maskRectTransform = maskRawImageObject.GetComponent<RectTransform>(); float num10 = secondWindowPixelWidth; rect = originalCamera.rect; float num11 = (int)(num10 / ((Rect)(ref rect)).width * (float)WindowManager.referenceSecondWindowWidth / (float)WindowManager.SecondWindowWidth); float num12 = secondWindowPixelHeight; rect = originalCamera.rect; maskRectTransform.sizeDelta = new Vector2(num11, (float)(int)(num12 / ((Rect)(ref rect)).height * (float)WindowManager.referenceSecondWindowHeight / (float)WindowManager.SecondWindowHeight)); maskRawImage.texture = null; ((Graphic)maskRawImage).color = Color.black; yield return null; ((Graphic)maskRawImage).color = Color.white; maskRawImage.texture = (Texture)(object)maskRenderTexture; rect = Camera.main.rect; float pixelWidth = ((Rect)(ref rect)).width; rect = Camera.main.rect; float pixelHeight = ((Rect)(ref rect)).height; maskMaterial.SetVector("_MaskRect", new Vector4((1f - pixelWidth) / 2f, (1f - pixelHeight) / 2f, pixelWidth, pixelHeight)); Graphics.Blit((Texture)null, maskRenderTexture, maskMaterial); } if ((Object)(object)originalCamera != (Object)null) { rectFullscreen = originalCamera.rect; rectSmall = new Rect(0.25f * ((Rect)(ref rectFullscreen)).width + 0.5f, 0.1625f * ((Rect)(ref rectFullscreen)).height + 0.5f, 0.25f * ((Rect)(ref rectFullscreen)).width, 0.25f * ((Rect)(ref rectFullscreen)).height); } ChangeMouseSensitivityMultipliers(); } } private IEnumerator InitializeOptions() { isInitializingOptions = true; while (true) { if ((Object)(object)optionsMenuPanelDaveObject == (Object)null) { optionsMenuPanelDaveObject = GameObject.Find("OptionsMenuPanelDave"); } if ((Object)(object)optionsMenuPanelDaveObject == (Object)null) { yield return null; continue; } FullOptionsMenuController fullOptionsMenuController = optionsMenuPanelDaveObject.GetComponent<FullOptionsMenuController>(); if ((Object)(object)fullOptionsMenuController == (Object)null) { yield return null; continue; } if (!fullOptionsMenuController.IsVisible) { yield return null; continue; } if ((Object)(object)videoOptionsScrollablePanelObject == (Object)null) { videoOptionsScrollablePanelObject = GameObject.Find("VideoOptionsScrollablePanel"); } if ((Object)(object)videoOptionsScrollablePanelObject != (Object)null) { break; } yield return null; } while ((Object)(object)secondWindowResolutionTipObject == (Object)null) { GameObject controllerTypeArrowSelectorPanelObject = GameObject.Find("VisualPresetArrowSelectorPanel"); GameObject playerOneLabelPanelObject = GameObject.Find("PlayerOneLabelPanel"); if ((Object)(object)playerOneLabelPanelObject != (Object)null) { secondWindowResolutionTipObject = Object.Instantiate<GameObject>(playerOneLabelPanelObject, controllerTypeArrowSelectorPanelObject.transform.parent); ((Object)secondWindowResolutionTipObject).name = "ShareOneKeyBoardWarningPanel"; GameObject labelObject = ((Component)secondWindowResolutionTipObject.transform.Find("PanelEnsmallenerThatmakesDavesLifeHardandBrentsLifeEasy/Label")).gameObject; labelObject.GetComponent<dfLabel>().Text = (((int)GameManager.Options.CurrentLanguage == 11) ? "重启以生效第二窗口启动分辨率。\n大于实际分辨率无效。" : "Restart to activate second window startup \nresolution. Invalid if greater than the actual one."); ((dfControl)labelObject.GetComponent<dfLabel>()).Color = new Color32(byte.MaxValue, (byte)0, (byte)0, byte.MaxValue); GameObject panelEnsmallenerThatmakesDavesLifeHardandBrentsLifeEasyObject = ((Component)secondWindowResolutionTipObject.transform.Find("PanelEnsmallenerThatmakesDavesLifeHardandBrentsLifeEasy")).gameObject; Vector3 position = panelEnsmallenerThatmakesDavesLifeHardandBrentsLifeEasyObject.transform.localPosition; panelEnsmallenerThatmakesDavesLifeHardandBrentsLifeEasyObject.transform.localPosition = new Vector3(position.x, position.y + 0.11f, position.z); ((dfControl)secondWindowResolutionTipObject.GetComponent<dfPanel>()).ZOrder = 0; } if ((Object)(object)secondWindowResolutionTipObject == (Object)null) { yield return null; } } while ((Object)(object)secondWindowStartupResolutionSelectorPanelObject == (Object)null) { GameObject controllerTypeArrowSelectorPanelObject2 = GameObject.Find("VisualPresetArrowSelectorPanel"); if ((Object)(object)controllerTypeArrowSelectorPanelObject2 != (Object)null) { secondWindowStartupResolutionSelectorPanelObject = Object.Instantiate<GameObject>(controllerTypeArrowSelectorPanelObject2, controllerTypeArrowSelectorPanelObject2.transform.parent); ((Object)secondWindowStartupResolutionSelectorPanelObject).name = "SecondWindowStartupResolutionSelectorPanel"; GameObject optionsArrowSelectorLabelObject = ((Component)secondWindowStartupResolutionSelectorPanelObject.transform.Find("PanelEnsmallenerThatmakesDavesLifeHardandBrentsLifeEasy/OptionsArrowSelectorLabel")).gameObject; optionsArrowSelectorLabelObject.GetComponent<dfLabel>().Text = (((int)GameManager.Options.CurrentLanguage == 11) ? "第二窗口启动分辨率" : "Second Window Startup Resolution"); secondWindowStartupResolutionSelectorPanelObject.GetComponent<BraveOptionsMenuItem>().optionType = (BraveOptionsOptionType)512; secondWindowStartupResolutionSelectorPanelObject.GetComponent<BraveOptionsMenuItem>().DetermineAvailableOptions(); secondWindowStartupResolutionSelectorPanelObject.GetComponent<BraveOptionsMenuItem>().m_selectedIndex = secondWindowStartupResolution; secondWindowStartupResolutionSelectorPanelObject.GetComponent<BraveOptionsMenuItem>().HandleValueChanged(); ((dfControl)secondWindowStartupResolutionSelectorPanelObject.GetComponent<dfPanel>()).ZOrder = 1; } if ((Object)(object)secondWindowStartupResolutionSelectorPanelObject == (Object)null) { yield return null; } } dfList<dfControl> controls = ((dfControl)GameObject.Find("VideoOptionsScrollablePanel").GetComponent<dfScrollPanel>()).controls; int i = 0; while (i < controls.Count - 1) { int num; if (((dfControl)((Component)controls[i]).gameObject.GetComponent<dfPanel>()).CanFocus) { int k = i + 1; while (k < controls.Count - 1 && !((dfControl)((Component)controls[k]).gameObject.GetComponent<dfPanel>()).CanFocus) { num = k + 1; k = num; } if (k < controls.Count - 1) { ((Component)controls[i]).gameObject.GetComponent<BraveOptionsMenuItem>().down = controls[k]; } } num = i + 1; i = num; } int j = controls.Count - 1; while (j > 0) { int num; if (((dfControl)((Component)controls[j]).gameObject.GetComponent<dfPanel>()).CanFocus) { int l = j - 1; while (l > 0 && !((dfControl)((Component)controls[l]).gameObject.GetComponent<dfPanel>()).CanFocus) { num = l - 1; l = num; } if (l > 0) { ((Component)controls[j]).gameObject.GetComponent<BraveOptionsMenuItem>().up = controls[l]; } } num = j - 1; j = num; } int indexCanSelect = 0; while (indexCanSelect < controls.Count && !controls[indexCanSelect].CanFocus) { int num = indexCanSelect + 1; indexCanSelect = num; } if (controls.Count > 0 && indexCanSelect < controls.Count && ((dfControl)optionsMenuPanelDaveObject.GetComponent<FullOptionsMenuController>().TabVideo).IsVisible) { GameObject.Find("ConfirmButton").GetComponent<UIKeyControls>().down = controls[indexCanSelect]; GameObject.Find("CancelButton").GetComponent<UIKeyControls>().down = controls[indexCanSelect]; GameObject.Find("ResetDefaultsButton").GetComponent<UIKeyControls>().down = controls[indexCanSelect]; ((Component)controls[indexCanSelect]).gameObject.GetComponent<BraveOptionsMenuItem>().up = (dfControl)(object)GameObject.Find("ConfirmButton").GetComponent<dfButton>(); controls[indexCanSelect].Focus(true); } isInitializingOptions = false; } private void Changed_Render(dfGUIManager manager) { //IL_01e7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)manager.meshRenderer == (Object)null) { return; } ((Renderer)manager.meshRenderer).enabled = false; int framesRendered = manager.FramesRendered; manager.FramesRendered = framesRendered + 1; try { manager.occluders.Clear(); manager.occluders.EnsureCapacity(manager.NumControlsRendered); manager.NumControlsRendered = 0; manager.controlsRendered.Clear(); manager.drawCallIndices.Clear(); manager.renderGroups.Clear(); manager.TotalDrawCalls = 0; manager.TotalTriangles = 0; if ((Object)(object)manager.RenderCamera == (Object)null || !((Behaviour)manager).enabled) { if ((Object)(object)manager.meshRenderer != (Object)null) { ((Renderer)manager.meshRenderer).enabled = false; } return; } if ((Object)(object)manager.meshRenderer != (Object)null && !((Renderer)manager.meshRenderer).enabled) { ((Renderer)manager.meshRenderer).enabled = true; } if (manager.renderMesh == null || manager.renderMesh.Length == 0) { Debug.LogError((object)"GUI Manager not initialized before Render() called"); return; } manager.resetDrawCalls(); dfRenderData val = null; manager.clipStack.Clear(); manager.clipStack.Push(dfTriangleClippingRegion.Obtain()); uint sTART_VALUE = dfChecksumUtil.START_VALUE; dfList<dfControl> topLevelControls = manager.getTopLevelControls(); try { manager.updateRenderOrder(topLevelControls); for (int i = 0; i < topLevelControls.Count; i++) { if (manager.abortRendering) { break; } dfControl val2 = topLevelControls[i]; manager.renderControl(ref val, val2, sTART_VALUE, 1f); } } finally { ((IDisposable)topLevelControls)?.Dispose(); } if (manager.abortRendering) { manager.clipStack.Clear(); throw new dfAbortRenderingException(); } manager.drawCallBuffers.RemoveAll((Predicate<dfRenderData>)manager.isEmptyBuffer); manager.drawCallCount = manager.drawCallBuffers.Count; manager.TotalDrawCalls = manager.drawCallCount; if (manager.drawCallBuffers.Count == 0) { if ((Object)(object)manager.renderFilter.sharedMesh != (Object)null) { manager.renderFilter.sharedMesh.Clear(); } if (manager.clipStack.Count > 0) { manager.clipStack.Pop().Release(); manager.clipStack.Clear(); } return; } dfRenderData val3 = manager.compileMasterBuffer(); manager.TotalTriangles = val3.Triangles.Count / 3; Mesh renderMesh = manager.getRenderMesh(); manager.renderFilter.sharedMesh = renderMesh; Mesh val4 = renderMesh; val4.Clear(true); val4.vertices = val3.Vertices.Items; val4.uv = val3.UV.Items; val4.colors32 = val3.Colors.Items; if (manager.generateNormals && val3.Normals.Items.Length == val3.Vertices.Items.Length) { val4.normals = val3.Normals.Items; val4.tangents = val3.Tangents.Items; } val4.subMeshCount = manager.submeshes.Count; for (int j = 0; j < manager.submeshes.Count; j++) { int num = manager.submeshes[j]; int num2 = val3.Triangles.Count - num; if (j < manager.submeshes.Count - 1) { num2 = manager.submeshes[j + 1] - num; } int[] array = dfTempArray<int>.Obtain(num2); val3.Triangles.CopyTo(num, array, 0, num2); val4.SetTriangles(array, j); } } catch (dfAbortRenderingException) { manager.isDirty = true; manager.abortRendering = false; } finally { ((Renderer)manager.meshRenderer).enabled = true; } } public static void Changed_UpdateReloadLabelsOnCameraFinishedFrame(GameUIRoot gameUI) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Invalid comparison between Unknown and I4 //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) Vector3 val3 = default(Vector3); for (int i = 0; i < gameUI.m_displayingReloadNeeded.Count; i++) { if (gameUI.m_displayingReloadNeeded[i]) { 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)camera != (Object)null && (Object)(object)originalCamera != (Object)null) { val3 += -((Component)camera).transform.localPosition + ((Component)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)); } } } public static void Changed_OnMainCameraFinishedFrame(GameUIReloadBarController controller) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_0055: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_016e: 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) //IL_0193: 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)camera == (Object)null) && !((Object)(object)originalCamera == (Object)null)) ? Vector2.op_Implicit(controller.m_attachPlayer.LockedApproximateSpriteCenter - ((Component)camera).transform.localPosition + ((Component)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); } } } private static void DrawCursor(RenderTexture targetTexture) { //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Invalid comparison between Unknown and I4 //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_0613: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0620: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_0643: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_0659: Unknown result type (might be due to invalid IL or missing references) //IL_065d: Unknown result type (might be due to invalid IL or missing references) //IL_0667: Unknown result type (might be due to invalid IL or missing references) //IL_066c: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_0680: Unknown result type (might be due to invalid IL or missing references) //IL_0682: Unknown result type (might be due to invalid IL or missing references) //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_06bc: Unknown result type (might be due to invalid IL or missing references) //IL_06dd: Unknown result type (might be due to invalid IL or missing references) //IL_06e2: Unknown result type (might be due to invalid IL or missing references) //IL_06e6: Unknown result type (might be due to invalid IL or missing references) //IL_06f3: Unknown result type (might be due to invalid IL or missing references) //IL_0718: Unknown result type (might be due to invalid IL or missing references) //IL_0725: Unknown result type (might be due to invalid IL or missing references) //IL_074a: Unknown result type (might be due to invalid IL or missing references) //IL_075f: Unknown result type (might be due to invalid IL or missing references) //IL_07ac: Unknown result type (might be due to invalid IL or missing references) //IL_07c3: Unknown result type (might be due to invalid IL or missing references) //IL_07db: Unknown result type (might be due to invalid IL or missing references) if (!GameManager.HasInstance || (Object)(object)gameCursorController == (Object)null) { return; } Texture2D val = gameCursorController.normalCursor; int currentCursorIndex = GameManager.Options.CurrentCursorIndex; if (currentCursorIndex >= 0 && currentCursorIndex < gameCursorController.cursors.Length) { val = gameCursorController.cursors[currentCursorIndex]; } if (GameCursorController.showMouseCursor) { if (RawInputHandler.ShowTwoMouseCursor) { Vector2 val2 = ((CoopKBnMModule.currentPlayerOneMousePort != 0) ? RawInputHandler.firstMousePosition : RawInputHandler.secondMousePosition); Vector2 val3 = new Vector2((float)((Texture)val).width, (float)((Texture)val).height) * (float)((!((Object)(object)Pixelator.Instance != (Object)null)) ? 3 : ((int)Pixelator.Instance.ScaleTileScale)); Rect val4 = default(Rect); ((Rect)(ref val4))..ctor((val2.x + 0.5f - val3.x / 2f - (float)(Screen.width / 2)) * (float)WindowManager.referenceSecondWindowWidth / (float)Screen.width, (val2.y + 0.5f - val3.y / 2f - (float)(Screen.height / 2)) * (float)WindowManager.referenceSecondWindowHeight / (float)Screen.height, val3.x * (float)WindowManager.referenceSecondWindowWidth / (float)Screen.width, val3.y * (float)WindowManager.referenceSecondWindowHeight / (float)Screen.height); ((Rect)(ref val4))..ctor(((Rect)(ref val4)).x, ((Rect)(ref val4)).y + ((Rect)(ref val4)).height, ((Rect)(ref val4)).width, 0f - ((Rect)(ref val4)).height); RenderTexture.active = targetTexture; Graphics.DrawTexture(val4, (Texture)(object)val, new Rect(0f, 0f, 1f, 1f), 0, 0, 0, 0, new Color(0.402f, 0.111f, 0.32f)); RenderTexture.active = null; } if (RawInputHandler.ShowPublicCursor) { Vector2 firstMousePosition = RawInputHandler.firstMousePosition; Vector2 val5 = new Vector2((float)((Texture)val).width, (float)((Texture)val).height) * (float)((!((Object)(object)Pixelator.Instance != (Object)null)) ? 3 : ((int)Pixelator.Instance.ScaleTileScale)); Rect val6 = default(Rect); ((Rect)(ref val6))..ctor((firstMousePosition.x + 0.5f - val5.x / 2f - (float)(Screen.width / 2)) * (float)WindowManager.referenceSecondWindowWidth / (float)Screen.width, (firstMousePosition.y + 0.5f - val5.y / 2f - (float)(Screen.height / 2)) * (float)WindowManager.referenceSecondWindowHeight / (float)Screen.height, val5.x * (float)WindowManager.referenceSecondWindowWidth / (float)Screen.width, val5.y * (float)WindowManager.referenceSecondWindowHeight / (float)Screen.height); ((Rect)(ref val6))..ctor(((Rect)(ref val6)).x, ((Rect)(ref val6)).y + ((Rect)(ref val6)).height, ((Rect)(ref val6)).width, 0f - ((Rect)(ref val6)).height); if ((int)GameManager.Instance.CurrentGameType == 1 && !BraveInput.GetInstanceForPlayer(0).IsKeyboardAndMouse(false) && BraveInput.GetInstanceForPlayer(1).IsKeyboardAndMouse(false)) { RenderTexture.active = targetTexture; Graphics.DrawTexture(val6, (Texture)(object)val, new Rect(0f, 0f, 1f, 1f), 0, 0, 0, 0, new Color(0.402f, 0.111f, 0.32f)); RenderTexture.active = null; } else { RenderTexture.active = targetTexture; Graphics.DrawTexture(val6, (Texture)(object)val); RenderTexture.active = null; } } } PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; Vector2 vector; if (!CoopKBnMModule.restrictMouseInputPort && (Object)(object)originalCameraController.m_player != (Object)(object)primaryPlayer && GameCursorController.showPlayerOneControllerCursor && !GameManager.Instance.IsPaused && !GameManager.IsBossIntro) { BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(0); if (Object.op_Implicit((Object)(object)primaryPlayer) && ((TwoAxisInputControl)instanceForPlayer.ActiveActions.Aim).Vector != Vector2.zero && ((int)primaryPlayer.CurrentInputState == 0 || primaryPlayer.IsInMinecart)) { Camera obj = camera; Vector2 centerPosition = ((GameActor)primaryPlayer).CenterPosition; vector = ((TwoAxisInputControl)instanceForPlayer.ActiveActions.Aim).Vector; Vector2 val7 = Vector2.op_Implicit(obj.WorldToViewportPoint(Vector2.op_Implicit(centerPosition + ((Vector2)(ref vector)).normalized * 5f))); Vector2 val8 = BraveCameraUtility.ConvertGameViewportToScreenViewport(val7); Vector2 val9 = default(Vector2); ((Vector2)(ref val9))..ctor(val8.x * (float)Screen.width, val8.y * (float)Screen.height); Vector2 val10 = new Vector2((float)((Texture)val).width, (float)((Texture)val).height) * (float)((!((Object)(object)Pixelator.Instance != (Object)null)) ? 3 : ((int)Pixelator.Instance.ScaleTileScale)); Rect val11 = default(Rect); ((Rect)(ref val11))..ctor((val9.x + 0.5f - val10.x / 2f - (float)(Screen.width / 2)) * (float)WindowManager.referenceSecondWindowWidth / (float)Screen.width, (val9.y + 0.5f - val10.y / 2f - (float)(Screen.height / 2)) * (float)WindowManager.referenceSecondWindowHeight / (float)Screen.height, val10.x * (float)WindowManager.referenceSecondWindowWidth / (float)Screen.width, val10.y * (float)WindowManager.referenceSecondWindowHeight / (float)Screen.height); ((Rect)(ref val11))..ctor(((Rect)(ref val11)).x, ((Rect)(ref val11)).y + ((Rect)(ref val11)).height, ((Rect)(ref val11)).width, 0f - ((Rect)(ref val11)).height); RenderTexture.active = targetTexture; Graphics.DrawTexture(val11, (Texture)(object)val); RenderTexture.active = null; } } PlayerController secondaryPlayer = GameManager.Instance.SecondaryPlayer; if (!CoopKBnMModule.restrictMouseInputPort && (Object)(object)originalCameraController.m_player != (Object)(object)secondaryPlayer && GameCursorController.showPlayerTwoControllerCursor && !GameManager.Instance.IsPaused && !GameManager.IsBossIntro) { BraveInput instanceForPlayer2 = BraveInput.GetInstanceForPlayer(1); if (Object.op_Implicit((Object)(object)secondaryPlayer) && ((TwoAxisInputControl)instanceForPlayer2.ActiveActions.Aim).Vector != Vector2.zero && ((int)secondaryPlayer.CurrentInputState == 0 || secondaryPlayer.IsInMinecart)) { Camera obj2 = camera; Vector2 centerPosition2 = ((GameActor)secondaryPlayer).CenterPosition; vector = ((TwoAxisInputControl)instanceForPlayer2.ActiveActions.Aim).Vector; Vector2 val12 = Vector2.op_Implicit(obj2.WorldToViewportPoint(Vector2.op_Implicit(centerPosition2 + ((Vector2)(ref vector)).normalized * 5f))); Vector2 val13 = BraveCameraUtility.ConvertGameViewportToScreenViewport(val12); Vector2 val14 = default(Vector2); ((Vector2)(ref val14))..ctor(val13.x * (float)Screen.width, val13.y * (float)Screen.height); Vector2 val15 = new Vector2((float)((Texture)val).width, (float)((Texture)val).height) * (float)((!((Object)(object)Pixelator.Instance != (Object)null)) ? 3 : ((int)Pixelator.Instance.ScaleTileScale)); Rect val16 = default(Rect); ((Rect)(ref val16))..ctor((val14.x + 0.5f - val15.x / 2f - (float)(Screen.width / 2)) * (float)WindowManager.referenceSecondWindowWidth / (float)Screen.width, (val14.y + 0.5f - val15.y / 2f - (float)(Screen.height / 2)) * (float)WindowManager.referenceSecondWindowHeight / (float)Screen.height, val15.x * (float)WindowManager.referenceSecondWindowWidth / (float)Screen.width, val15.y * (float)WindowManager.referenceSecondWindowHeight / (float)Screen.height); ((Rect)(ref val16))..ctor(((Rect)(ref val16)).x, ((Rect)(ref val16)).y + ((Rect)(ref val16)).height, ((Rect)(ref val16)).width, 0f - ((Rect)(ref val16)).height); RenderTexture.active = targetTexture; Graphics.DrawTexture(val16, (Texture)(object)val, new Rect(0f, 0f, 1f, 1f), 0, 0, 0, 0, new Color(0.402f, 0.111f, 0.32f)); RenderTexture.active = null; } } } public static IEnumerator ChangeMouseSensitivityMultipliersCrt() { while (!RawInputHandler.mousePortReady) { yield return null; } ChangeMouseSensitivityMultipliers(); } private static void ChangeMouseSensitivityMultipliers() { if (!((Object)(object)Camera.main == (Object)null)) { if (CoopKBnMModule.currentPlayerOneMousePort == 0) { RawInputHandler.playerOneMouseSensitivityMultiplier = 1f; RawInputHandler.playerTwoMouseSensitivityMultiplier = (float)Camera.main.pixelWidth / (float)secondWindowPixelWidth; } else { RawInputHandler.playerOneMouseSensitivityMultiplier = (float)Camera.main.pixelWidth / (float)secondWindowPixelWidth; RawInputHandler.playerTwoMouseSensitivityMultiplier = 1f; } RawInputHandler.mousePortReady = false; } } } public static class CoopViewPatches { private static CameraController controller_PitRespawnPatch; [HarmonyILManipulator] [HarmonyPatch(typeof(CameraController), "GetCoreCurrentBasePosition")] 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>[3] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_AllPlayers"), (Instruction x) => ILPatternMatchingExt.MatchLdlen(x), (Instruction x) => ILPatternMatchingExt.MatchConvI4(x) })) { val.EmitDelegate<Func<int, int>>((Func<int, int>)((int orig) => 1)); } } [HarmonyILManipulator] [HarmonyPatch(typeof(CameraController), "GetCoreOffset")] 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0265: 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>[3] { (Instruction x) => ILPatternMatchingExt.Match(x, OpCodes.Brfalse), (Instruction x) => ILPatternMatchingExt.MatchCall<GameManager>(x, "get_Instance"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_CurrentGameType") })) { val.EmitDelegate<Func<GameType, bool>>((Func<GameType, bool>)((GameType orig) => false)); } if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCall<Input>(x, "get_mousePosition") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<Vector3, CameraController, Vector3>>((Func<Vector3, CameraController, Vector3>)((Vector3 orig, CameraController self) => CoopKBnMModule.restrictMouseInputPort ? ((CoopKBnMModule.currentPlayerOneMousePort == 0) ? ((!self.m_player.IsPrimaryPlayer) ? Vector2Extensions.ToVector3ZUp(RawInputHandler.secondMousePosition, 0f) : orig) : ((!self.m_player.IsPrimaryPlayer) ? orig : Vector2Extensions.ToVector3ZUp(RawInputHandler.secondMousePosition, 0f))) : orig)); } if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchCall<BraveInput>(x, "GetInstanceForPlayer"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<BraveInput>(x, "get_ActiveActions"), (Instruction x) => ILPatternMatchingExt.Match(x, OpCodes.Stloc_S) })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<int, CameraController, int>>((Func<int, CameraController, int>)((int orig, CameraController self) => (!((Object)(object)self.m_player == (Object)(object)GameManager.Instance.PrimaryPlayer)) ? 1 : 0)); } val.Index += 2; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1), (Instruction x) => ILPatternMatchingExt.Match(x, OpCodes.Bne_Un), (Instruction x) => ILPatternMatchingExt.MatchCall<GameManager>(x, "get_Instance"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_PrimaryPlayer") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<PlayerController, CameraController, PlayerController>>((Func<PlayerController, CameraController, PlayerController>)((PlayerController orig, CameraController self) => self.m_player)); } if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CameraController>(x, "OverrideZoomScale") })) { val.EmitDelegate<Func<CameraController, CameraController>>((Func<CameraController, CameraController>)((CameraController orig) => ((Object)(object)CoopViewModule.camera != (Object)null && (Object)(object)orig == (Object)(object)CoopViewModule.cameraController) ? GameManager.Instance.MainCameraController : orig)); } if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.Match(x, OpCodes.Bne_Un), (Instruction x) => ILPatternMatchingExt.MatchCall<GameManager>(x, "get_Instance"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_CurrentGameType") })) { val.EmitDelegate<Func<GameType, bool>>((Func<GameType, bool>)((GameType orig) => false)); } } [HarmonyPrefix] [HarmonyPatch(typeof(PlayerController), "ReinitializeMovementRestrictors")] public static bool ReinitializeMovementRestrictors_Pre() { return false; } [HarmonyILManipulator] [HarmonyPatch(typeof(PlayerController), "InitializeCallbacks")] 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 //IL_0132: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(ctx); ILLabel val2 = val.DefineLabel(); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerController>(x, "inventory"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdftn<PlayerController>(x, "OnGunChanged") })) { val2 = val.MarkLabel(); } val.Index = 0; if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCall<BraveBehaviour>(x, "get_specRigidbody"), (Instruction x) => ILPatternMatchingExt.MatchDup(x) })) { val.Emit(OpCodes.Br, (object)val2); } } [HarmonyILManipulator] [HarmonyPatch(/*Could not decode attribute arguments.*/)] 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_0081: 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>[3] { (Instruction x) => ILPatternMatchingExt.MatchCall<BraveInput>(x, "GetInstanceForPlayer"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<BraveInput>(x, "IsKeyboardAndMouse") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<int, CameraController, int>>((Func<int, CameraController, int>)((int orig, CameraController self) => (!((Object)(object)self.m_player == (Object)(object)GameManager.Instance.PrimaryPlayer)) ? 1 : 0)); } } [HarmonyILManipulator] [HarmonyPatch(typeof(PlayerController), "DetermineAimPointInWorld")] public static void DetermineAimPointInWorldPatch(ILContext ctx) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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>[3] { (Instruction x) => ILPatternMatchingExt.MatchCall<GameManager>(x, "get_Instance"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_MainCameraController"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Component>(x, "GetComponent") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<Camera, PlayerController, Camera>>((Func<Camera, PlayerController, Camera>)((Camera orig, PlayerController self) => ((Object)(object)CoopViewModule.camera != (Object)null && (Object)(object)CoopViewModule.originalCamera != (Object)null) ? ((CoopKBnMModule.restrictMouseInputPort || (!BraveInput.GetInstanceForPlayer(0).IsKeyboardAndMouse(false) && !BraveInput.GetInstanceForPlayer(1).IsKeyboardAndMouse(false))) ? (self.IsPrimaryPlayer ? CoopViewModule.originalCamera : CoopViewModule.camera) : (self.IsKeyboardAndMouse() ? CoopViewModule.originalCamera : CoopViewModule.camera)) : orig)); } if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, 33), (Instruction x) => ILPatternMatchingExt.MatchCall<GameManager>(x, "get_Instance"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_MainCameraController") })) { val.Emit(OpCodes.Ldloc_1); val.EmitDelegate<Func<CameraController, Camera, CameraController>>((Func<CameraController, Camera, CameraController>)((CameraController orig, Camera camera) => ((Object)(object)CoopViewModule.originalCamera != (Object)null) ? (((Object)(object)camera == (Object)(object)CoopViewModule.originalCamera) ? CoopViewModule.originalCameraController : CoopViewModule.cameraController) : orig)); } } [HarmonyILManipulator] [HarmonyPatch(typeof(PlayerController), "CheckSpawnAlertArrows")] public static void CheckSpawnAlertArrowsPatch(ILContext ctx) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00fe: 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>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCall<PlayerController>(x, "get_IsPrimaryPlayer") })) { val.EmitDelegate<Func<bool, bool>>((Func<bool, bool>)((bool orig) => true)); } if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.Match(x, OpCodes.Br), (Instruction x) => ILPatternMatchingExt.MatchCall<GameManager>(x, "get_Instance"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_MainCameraController") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<CameraController, PlayerController, CameraController>>((Func<CameraController, PlayerController, CameraController>)((CameraController orig, PlayerController self) => ((Object)(object)CoopViewModule.camera != (Object)null && (Object)(object)CoopViewModule.originalCamera != (Object)null) ? ((CoopKBnMModule.restrictMouseInputPort || (!BraveInput.GetInstanceForPlayer(0).IsKeyboardAndMouse(false) && !BraveInput.GetInstanceForPlayer(1).IsKeyboardAndMouse(false))) ? (self.IsPrimaryPlayer ? CoopViewModule.originalCameraController : CoopViewModule.cameraController) : (self.IsKeyboardAndMouse() ? CoopViewModule.originalCameraController : CoopViewModule.cameraController)) : orig)); } } [HarmonyILManipulator] [HarmonyPatch(typeof(PlayerController), "LateUpdate")] 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>[2] { (Instruction x) => ILPatternMatchingExt.MatchCall<GameManager>(x, "get_Instance"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_MainCameraController") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<CameraController, PlayerController, CameraController>>((Func<CameraController, PlayerController, CameraController>)((CameraController orig, PlayerController self) => ((Object)(object)CoopViewModule.camera != (Object)null && (Object)(object)CoopViewModule.originalCamera != (Object)null) ? ((CoopKBnMModule.restrictMouseInputPort || (!BraveInput.GetInstanceForPlayer(0).IsKeyboardAndMouse(false) && !BraveInput.GetInstanceForPlayer(1).IsKeyboardAndMouse(false))) ? (self.IsPrimaryPlayer ? CoopViewModule.originalCameraController : CoopViewModule.cameraController) : (self.IsKeyboardAndMouse() ? CoopViewModule.originalCameraController : CoopViewModule.cameraController)) : orig)); } } [HarmonyPostfix] [HarmonyPatch(typeof(Pixelator), "FadeToBlack")] private static void FadeToBlack_Post(Pixelator __instance, float duration, bool reverse = false, float holdTime = 0f) { if ((Object)(object)__instance == (Object)(object)Pixelator.Instance && (Object)(object)CoopViewModule.cameraPixelator != (Object)null) { Orig_FadeToBlack(CoopViewModule.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)); } } [HarmonyPostfix] [HarmonyPatch(typeof(Pixelator), "FadeToColor")] private static void FadeToColor_Post(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)CoopViewModule.cameraPixelator != (Object)null) { Orig_FadeToColor(CoopViewModule.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)); } } [HarmonyPostfix] [HarmonyPatch(typeof(CameraController), "AddFocusPoint", new Type[] { typeof(GameObject) })] private static void AddFocusPoint_Post(CameraController __instance, GameObject go) { if ((Object)(object)__instance == (Object)(object)GameManager.Instance.MainCameraController && (Object)(object)CoopViewModule.camera != (Object)null) { Orig_AddFocusPoint(CoopViewModule.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); } } [HarmonyPostfix] [HarmonyPatch(typeof(CameraController), "SetZoomScaleImmediate")] private static void SetZoomScaleImmediate_Post(CameraController __instance, float zoomScale) { if ((Object)(object)__instance == (Object)(object)GameManager.Instance.MainCameraController && (Object)(object)CoopViewModule.camera != (Object)null) { Orig_SetZoomScaleImmediate(); } } private static void Orig_SetZoomScaleImmediate() { if ((Object)(object)CoopViewModule.cameraPixelator != (Object)null) { CameraController originalCameraController = CoopViewModule.originalCameraController; CoopViewModule.cameraPixelator.NUM_MACRO_PIXELS_HORIZONTAL = (int)dfNumberExtensions.Quantize((float)BraveCameraUtility.H_PIXELS / originalCameraController.CurrentZoomScale, 2f); CoopViewModule.cameraPixelator.NUM_MACRO_PIXELS_VERTICAL = (int)dfNumberExtensions.Quantize((float)BraveCameraUtility.V_PIXELS / originalCameraController.CurrentZoomScale, 2f); } } [HarmonyPostfix] [HarmonyPatch(typeof(CameraController), "RemoveFocusPoint", new Type[] { typeof(GameObject) })] private static void RemoveFocusPoint_Post(CameraController __instance, GameObject go) { if ((Object)(object)__instance == (Object)(object)GameManager.Instance.MainCameraController && (Object)(object)CoopViewModule.camera != (Object)null) { Orig_RemoveFocusPoint(CoopViewModule.cameraController, go); } } private static void Orig_RemoveFocusPoint(CameraController self, GameObject go) { self.m_focusObjects.Remove((Object)(object)go); } [HarmonyPostfix] [HarmonyPatch(typeof(CameraController), "SetManualControl")] private static void SetManualControl_Post(CameraController __instance, bool manualControl, bool shouldLerp = true) { if ((Object)(object)__instance == (Object)(object)GameManager.Instance.MainCameraController && (Object)(object)CoopViewModule.camera != (Object)null) { Orig_SetManualControl(CoopViewModule.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; } } [HarmonyPostfix] [HarmonyPatch(typeof(CameraController), "DoContinuousScreenShake")] private static void DoContinuousScreenShake_Post(CameraController __instance, ScreenShakeSettings shakesettings, Component source, bool isPlayerGun = false) { if ((Object)(object)__instance == (Object)(object)GameManager.Instance.MainCameraController && (Object)(object)CoopViewModule.camera != (Object)null) { Orig_DoContinuousScreenShake(CoopViewModule.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); } [HarmonyPostfix] [HarmonyPatch(typeof(CameraController), "StopContinuousScreenShake")] private static void StopContinuousScreenShake_Post(CameraController __instance, Component source) { if ((Object)(object)__instance == (Object)(object)GameManager.Instance.MainCameraController && (Object)(object)CoopViewModule.camera != (Object)null) { Orig_StopContinuousScreenShake(CoopViewModule.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); } } [HarmonyILManipulator] [HarmonyPatch(typeof(CameraController), "GetAimContribution")] 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.EmitDelegate<Func<CameraController, CameraController>>((Func<CameraController, CameraController>)((CameraController orig) => ((Object)(object)CoopViewModule.camera != (Object)null && (Object)(object)orig == (Object)(object)CoopViewModule.cameraController) ? GameManager.Instance.MainCameraController : orig)); } } [HarmonyILManipulator] [HarmonyPatch(/*Could not decode attribute arguments.*/)] 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.EmitDelegate<Func<CameraController, CameraController>>((Func<CameraController, CameraController>)((CameraController orig) => ((Object)(object)CoopViewModule.camera != (Object)null && (Object)(object)orig == (Object)(object)CoopViewModule.cameraController) ? GameManager.Instance.MainCameraController : orig)); } if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CameraController>(x, "OverrideZoomScale") })) { val.EmitDelegate<Func<CameraController, CameraController>>((Func<CameraController, CameraController>)((CameraController orig) => ((Object)(object)CoopViewModule.camera != (Object)null && (Object)(object)orig == (Object)(object)CoopViewModule.cameraController) ? GameManager.Instance.MainCameraController : orig)); } } [HarmonyILManipulator] [HarmonyPatch(/*Could not decode attribute arguments.*/)] 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.EmitDelegate<Func<CameraController, CameraController>>((Func<CameraController, CameraController>)((CameraController orig) => ((Object)(object)CoopViewModule.camera != (Object)null && (Object)(object)orig == (Object)(object)CoopViewModule.cameraController) ? GameManager.Instance.MainCameraController : orig)); } } [HarmonyILManipulator] [HarmonyPatch(/*Could not decode attribute arguments.*/)] 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(ctx); FieldInfo fieldInfo = AccessTools.Field(Type.GetType("PlayerController+<PitRespawn>c__Iterator13, Assembly-CSharp"), "$this"); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "PlayerController+<PitRespawn>c__Iterator13", "$this"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0), (Instruction x) => ILPatternMatchingExt.MatchStfld<PlayerController>(x, "m_interruptingPitRespawn") })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, fieldInfo); val.EmitDelegate<Action<PlayerController>>((Action<PlayerController>)delegate(PlayerController self) { if ((Object)(object)CoopViewModule.camera != (Object)null && (Object)(object)CoopViewModule.originalCamera != (Object)null) { if (CoopKBnMModule.restrictMouseInputPort || (!BraveInput.GetInstanceForPlayer(0).IsKeyboardAndMouse(false) && !BraveInput.GetInstanceForPlayer(1).IsKeyboardAndMouse(false))) { controller_PitRespawnPatch = (self.IsPrimaryPlayer ? CoopViewModule.originalCameraController : CoopViewModule.cameraController); } else { controller_PitRespawnPatch = (self.IsKeyboardAndMouse() ? CoopViewModule.originalCameraController : CoopViewModule.cameraController); } } else { controller_PitRespawnPatch = GameManager.Instance.MainCameraController; } }); } val.Index = 0; while (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchCall<GameManager>(x, "get_Instance"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_MainCameraController") })) { val.EmitDelegate<Func<CameraController, CameraController>>((Func<CameraController, CameraController>)((CameraController orig) => controller_PitRespawnPatch)); } if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchRet(x) })) { val.EmitDelegate<Action>((Action)delegate { controller_PitRespawnPatch = null; }); } } [HarmonyILManipulator] [HarmonyPatch(typeof(CameraController), "LateUpdate")] 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(ctx); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<ControllerCamSettings>(x, "forceTimer") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<CameraController>>((Action<CameraController>)delegate(CameraController self) { if (GameManager.Instance.AllPlayers.Length < 2) { self.m_player = GameManager.Instance.PrimaryPlayer; } else if (CoopKBnMModule.restrictMouseInputPort || (!BraveInput.GetInstanceForPlayer(0).IsKeyboardAndMouse(false) && !BraveInput.GetInstanceForPlayer(1).IsKeyboardAndMouse(false))) { if (((Object)self.Camera).name != "Camera Copy") { self.m_player = GameManager.Instance.PrimaryPlayer; } else { self.m_player = GameManager.Instance.SecondaryPlayer; } } else if (((Object)self.Camera).name != "Camera Copy") { if (BraveInput.GetInstanceForPlayer(0).IsKeyboardAndMouse(false)) { self.m_player = GameManager.Instance.PrimaryPlayer; } else { self.m_player = GameManager.Instance.SecondaryPlayer; } } else if (BraveInput.GetInstanceForPlayer(1).IsKeyboardAndMouse(false)) { self.m_player = GameManager.Instance.PrimaryPlayer; } else { self.m_player = GameManager.Instance.SecondaryPlayer; } }); } val.Index = 0; while (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCall<Pixelator>(x, "get_Instance") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<Pixelator, CameraController, Pixelator>>((Func<Pixelator, CameraController, Pixelator>)((Pixelator orig, CameraController self) => ((Object)(object)CoopViewModule.originalCameraController != (Object)null) ? (((Object)(object)self == (Object)(object)CoopViewModule.originalCameraController) ? CoopViewModule.originCameraPixelator : CoopViewModule.cameraPixelator) : orig)); } val.Index = 0; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Transform>(x, "set_position"), (Instruction x) => ILPatternMatchingExt.MatchCall<Camera>(x, "get_main") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<Camera, CameraController, Camera>>((Func<Camera, CameraController, Camera>)((Camera orig, CameraController self) => self.Camera)); } if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchStfld<CameraController>(x, "m_cachedMinPos"), (Instruction x) => ILPatternMatchingExt.MatchCall<Camera>(x, "get_main") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<Camera, CameraController, Camera>>((Func<Camera, CameraController, Camera>)((Camera orig, CameraController self) => self.Camera)); } val.Index = 0; while (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CameraController>(x, "CurrentZoomScale") })) { val.EmitDelegate<Func<CameraController, CameraController>>((Func<CameraController, CameraController>)((CameraController orig) => ((Object)(object)CoopViewModule.camera != (Object)null && (Object)(object)orig == (Object)(object)CoopViewModule.cameraController) ? GameManager.Instance.MainCameraController : orig)); 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.EmitDelegate<Func<CameraController, CameraController>>((Func<CameraController, CameraController>)((CameraController orig) => ((Object)(object)CoopViewModule.camera != (Object)null && (Object)(object)orig == (Object)(object)CoopViewModule.cameraController) ? GameManager.Instance.MainCameraController : orig)); int index = val.Index; val.Index = index + 1; } val.Index = 0; if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CameraController>(x, "controllerCamera"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<ControllerCamSettings>(x, "isTransitioning") })) { val.EmitDelegate<Func<CameraController, CameraController>>((Func<CameraController, CameraController>)((CameraController orig) => ((Object)(object)CoopViewModule.camera != (Object)null && (Object)(object)orig == (Object)(object)CoopViewModule.cameraController) ? GameManager.Instance.MainCameraController : orig)); } val.Index = 0; if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CameraController>(x, "OverridePosition") })) { val.EmitDelegate<Func<CameraController, CameraController>>((Func<CameraController, CameraController>)((CameraController orig) => ((Object)(object)CoopViewModule.camera != (Object)null && (Object)(object)orig == (Object)(object)CoopViewModule.cameraController) ? GameManager.Instance.MainCameraController : orig)); } } [HarmonyILManipulator] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static void HandleThreatArrowPatch(ILContext ctx) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) FieldInfo fieldInfo = AccessTools.Field(Type.GetType("PlayerController+<HandleThreatArrow>c__IteratorB, Assembly-CSharp"), "$this"); ILCursor val = new ILCursor(ctx); while (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchCall<GameManager>(x, "get_Instance"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_MainCameraController") })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, fieldInfo); val.EmitDelegate<Func<CameraController, PlayerController, CameraController>>((Func<CameraController, PlayerController, CameraController>)((CameraController orig, PlayerController self) => ((Object)(object)CoopViewModule.camera != (Object)null && (Object)(object)CoopViewModule.originalCamera != (Object)null) ? ((CoopKBnMModule.restrictMouseInputPort || (!BraveInput.GetInstanceForPlayer(0).IsKeyboardAndMouse(false) && !BraveInput.GetInstanceForPlayer(1).IsKeyboardAndMouse(false))) ? (self.IsPrimaryPlayer ? CoopViewModule.originalCameraController : CoopViewModule.cameraController) : (self.IsKeyboardAndMouse() ? CoopViewModule.originalCameraController : CoopViewModule.cameraController)) : orig)); } } [HarmonyILManipulator] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static void InstancePatch(ILCo