Decompiled source of Mirror Mode v1.1.0

plugins/MirrorMode.dll

Decompiled 3 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using CellMenu;
using ChainedPuzzles;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyFileVersion("1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
internal class ManifestInfo
{
	internal const string TSName = "Mirror_Mode";

	internal const string TSDescription = "GTFO but the levels are flipped!";

	internal const string TSVersion = "1.1.0";

	internal const string TSAuthor = "AuriRex";

	internal const string TSWebsite = "https://github.com/AuriRex/GTFO_MirrorMode/";
}
namespace MirrorMode
{
	public class ApplyMirror : MonoBehaviour
	{
		private static readonly Vector2 _scale = new Vector2(-1f, 1f);

		private static readonly Vector2 _offset = new Vector2(1f, 0f);

		private void OnRenderImage(RenderTexture source, RenderTexture destination)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Graphics.Blit((Texture)(object)source, destination, _scale, _offset);
		}
	}
	public static class Patches
	{
		[HarmonyPatch(typeof(FPSCamera), "Setup", new Type[] { })]
		public static class FPSCamera__Setup__Patch
		{
			public static void Postfix(FPSCamera __instance)
			{
				Plugin.ApplyShaderTo(__instance);
			}
		}

		[HarmonyPatch(typeof(CM_PageObjectives), "OnEnable")]
		public static class CM_PageObjectives__OnEnable__Patch
		{
			private static bool _first = true;

			public static void Postfix(CM_PageObjectives __instance)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				if (_first)
				{
					_first = false;
					return;
				}
				Plugin.SetGUIRootMirrored(active: true);
				((GuiLayer)GuiManager.WatermarkLayer).CanvasTrans.localScale = Vector3.one;
			}
		}

		[HarmonyPatch(typeof(CM_PageMap), "OnEnable")]
		public static class CM_PageMap__OnEnable__Patch
		{
			private static bool _first = true;

			public static void Postfix(CM_PageMap __instance)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				if (_first)
				{
					_first = false;
					return;
				}
				Plugin.SetGUIRootMirrored(active: false);
				((GuiLayer)GuiManager.WatermarkLayer).CanvasTrans.localScale = INVERT_X;
			}
		}

		[HarmonyPatch(typeof(FocusStateManager), "ChangeState")]
		public static class FocusStateManager__ChangeState__Patch
		{
			public static void Postfix(FocusStateManager __instance, eFocusState state)
			{
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Invalid comparison between Unknown and I4
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Invalid comparison between Unknown and I4
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				((GuiLayer)GuiManager.WatermarkLayer).CanvasTrans.localScale = Vector3.one;
				if (state - 4 > 4)
				{
					if ((int)state == 13)
					{
						CM_PageMap current = CM_PageMap.Current;
						((Component)((CM_PageBase)current).m_cursor).transform.localScale = INVERT_X;
						((Transform)((CM_PageBase)current).m_staticContentHolder).localScale = INVERT_X;
						foreach (CM_MapPlayerGUIItem item in (Il2CppArrayBase<CM_MapPlayerGUIItem>)(object)current.m_syncedPlayers)
						{
							((Component)item).transform.localScale = INVERT_X;
						}
						if (((Behaviour)CM_PageMap.Current).isActiveAndEnabled)
						{
							((GuiLayer)GuiManager.WatermarkLayer).CanvasTrans.localScale = INVERT_X;
						}
					}
					else
					{
						Plugin.SetGUIRootMirrored(active: false);
					}
				}
				else
				{
					Plugin.SetGUIRootMirrored(active: true);
				}
			}
		}

		[HarmonyPatch(typeof(EnemyScannerGraphics), "Start")]
		public static class EnemyScannerGraphics__Start__Patch
		{
			public static void Postfix(EnemyScannerGraphics __instance)
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				Transform transform = ((Component)__instance.m_display).transform;
				if (!(transform.localScale.x < 0f))
				{
					transform.localScale = Vector3.Scale(transform.localScale, INVERT_X);
				}
			}
		}

		[HarmonyPatch(typeof(SentryGunScreen), "SetAmmo")]
		public static class SentryGunScreen__SetAmmo__Patch
		{
			public static void Postfix(SentryGunScreen __instance)
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)__instance == (Object)null) && !((Object)(object)((Component)__instance).transform == (Object)null))
				{
					if ((Object)(object)((Component)__instance).GetComponentInParent<SentryGunFirstPerson>() != (Object)null)
					{
						((Component)__instance).transform.localScale = Vector3.one;
					}
					else
					{
						((Component)__instance).transform.localScale = INVERT_X;
					}
				}
			}
		}

		[HarmonyPatch(typeof(GameStateManager), "DoChangeState")]
		public static class GameStateManager__DoChangeState__Patch
		{
			public static void Postfix(GameStateManager __instance, eGameStateName nextState)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: Invalid comparison between Unknown and I4
				if ((int)nextState == 10)
				{
					FlipMapIcons();
				}
			}

			private static void FlipMapIcons()
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				CM_PageMap current = CM_PageMap.Current;
				GameObject mapMoverElementsRoot = CM_PageMap.m_mapMoverElementsRoot;
				Transform val = ((mapMoverElementsRoot != null) ? mapMoverElementsRoot.transform : null);
				if ((Object)(object)val != (Object)null)
				{
					for (int i = 0; i < val.childCount; i++)
					{
						Transform child = val.GetChild(i);
						if (((Object)child).name.StartsWith("CM_MapElevator(Clone)"))
						{
							child.localScale = INVERT_X;
						}
					}
				}
				foreach (CM_MapZoneGUIItem item in (Il2CppArrayBase<CM_MapZoneGUIItem>)(object)current.m_zoneGUI)
				{
					foreach (CM_MapAreaGUIItem item2 in (Il2CppArrayBase<CM_MapAreaGUIItem>)(object)item.m_areaGUIs)
					{
						FlipGuiItems(item2.m_signGUIs);
						FlipGuiItems(item2.m_computerTerminalGUIs);
						FlipGuiItems(item2.m_doorGUIs);
						FlipGuiItems(item2.m_bulkheadDoorControllerGUIs);
					}
				}
				static void FlipGuiItems(Il2CppReferenceArray<CM_SyncedGUIItem> items)
				{
					//IL_001c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0021: Unknown result type (might be due to invalid IL or missing references)
					//IL_0026: Unknown result type (might be due to invalid IL or missing references)
					foreach (CM_SyncedGUIItem item3 in (Il2CppArrayBase<CM_SyncedGUIItem>)(object)items)
					{
						((Component)item3).transform.localScale = Vector3.Scale(((Component)item3).transform.localScale, INVERT_X);
					}
				}
			}
		}

		[HarmonyPatch(typeof(GuiManager), "ScreenToGUIScaled")]
		public static class GuiManager__ScreenToGUIScaled__Patch
		{
			public static void Postfix(GuiManager __instance, ref Vector3 __result)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Invalid comparison between Unknown and I4
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Invalid comparison between Unknown and I4
				eFocusState currentState = FocusStateManager.CurrentState;
				if (currentState - 4 <= 3 || (int)currentState == 13)
				{
					__result.x *= -1f;
				}
			}
		}

		[HarmonyPatch(typeof(AkGameObj), "Update")]
		public static class AkGameObj__Update__Patch
		{
			private const string GAMEOBJECT_NAME_FILTER = "FPSLookCamera";

			public static void Postfix(AkGameObj __instance)
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: 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_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				if (!(((Object)__instance).name != "FPSLookCamera"))
				{
					Transform transform = ((Component)__instance).transform;
					Vector3 position = transform.position;
					Vector3 val = transform.forward * -1f;
					AkSoundEngine.SetObjectPosition(((Component)__instance).gameObject, position.x, position.y, position.z, val.x, val.y, val.z, transform.up.x, transform.up.y, transform.up.z);
				}
			}
		}

		[HarmonyPatch(typeof(LG_ComputerTerminal), "Setup")]
		public static class LG_ComputerTerminal__Setup__Patch
		{
			public static void Postfix(LG_ComputerTerminal __instance)
			{
				//IL_0058: 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_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				Transform val = ((Component)__instance).transform.Find("Graphics");
				if ((Object)(object)val == (Object)null)
				{
					GameObject screen = __instance.m_screen;
					val = ((screen != null) ? screen.transform.parent : null);
				}
				if ((Object)(object)val != (Object)null)
				{
					((Component)val).transform.localScale = INVERT_X;
				}
				Transform transform = __instance.m_serial.transform;
				transform.localPosition = Vector3.Scale(transform.localPosition, INVERT_X);
				transform.localScale = Vector3.Scale(transform.localScale, INVERT_X);
			}
		}

		[HarmonyPatch(typeof(LG_Sign), "SetZoneInfo")]
		public static class LG_Sign__SetZoneInfo__Patch
		{
			public static void Postfix(LG_Sign __instance)
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				__instance.m_text.transform.localScale = Vector3.Scale(__instance.m_text.transform.localScale, INVERT_X);
			}
		}

		[HarmonyPatch(typeof(LG_HSU), "Setup")]
		public static class LG_HSU__Setup__Patch
		{
			public static void Postfix(LG_HSU __instance)
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				TextMeshPro serial = __instance.m_serial;
				if (!((Object)(object)serial == (Object)null))
				{
					serial.transform.localScale = Vector3.Scale(serial.transform.localScale, INVERT_X);
					serial.transform.localPosition = new Vector3(-0.2889f, 0.559f, 0.5876f);
				}
			}
		}

		[HarmonyPatch(typeof(LG_PowerGenerator_Core), "Setup")]
		public static class LG_PowerGenerator_Core__Setup__Patch
		{
			public static void Postfix(LG_PowerGenerator_Core __instance)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((Component)__instance).transform.localScale = INVERT_X;
			}
		}

		[HarmonyPatch(typeof(LG_WeakResourceContainer), "Setup")]
		public static class LG_WeakResourceContainer__Setup__Patch
		{
			public static void Postfix(LG_WeakResourceContainer __instance)
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				LG_WeakResourceContainer_Graphics val = ((Il2CppObjectBase)__instance.m_graphics).TryCast<LG_WeakResourceContainer_Graphics>();
				if (!((Object)(object)val == (Object)null))
				{
					val.m_serialNoText.transform.localScale = Vector3.Scale(val.m_serialNoText.transform.localScale, INVERT_X);
				}
			}
		}

		[HarmonyPatch(typeof(CP_Bioscan_Core), "Setup")]
		public static class CP_Bioscan_Core__Setup__Patch
		{
			public static void Postfix(CP_Bioscan_Core __instance)
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				foreach (TextMeshPro componentsInChild in ((Component)__instance).GetComponentsInChildren<TextMeshPro>(true))
				{
					componentsInChild.transform.localScale = Vector3.Scale(componentsInChild.transform.localScale, INVERT_X);
				}
			}
		}

		[HarmonyPatch(typeof(LG_BulkheadDoorController_Core), "BuildBulkheadLogic")]
		public static class LG_BulkheadDoorController__BuildBulkheadLogic__Patch
		{
			public static void Postfix(LG_BulkheadDoorController_Core __instance)
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				Transform val = ((Component)__instance).transform.Find("Graphics");
				if ((Object)(object)val != (Object)null)
				{
					((Component)val).transform.localScale = INVERT_X;
				}
			}
		}

		[HarmonyPatch(typeof(LG_SecurityDoor), "SetNavInfo")]
		public static class LG_SecurityDoor__SetNavInfo__Patch
		{
			public static void Postfix(LG_SecurityDoor __instance)
			{
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				GUIX_VirtualSceneLink componentInChildren = ((Component)__instance).GetComponentInChildren<GUIX_VirtualSceneLink>(true);
				if (!((Object)(object)componentInChildren == (Object)null))
				{
					GUIX_Layer componentInChildren2 = ((Component)componentInChildren.m_virtualScene).gameObject.GetComponentInChildren<GUIX_Layer>(true);
					((Component)componentInChildren2).transform.localScale = INVERT_X;
					((Component)componentInChildren2).transform.localPosition = new Vector3(-0.8f, 0f, 0f);
				}
			}
		}

		[HarmonyPatch(typeof(LG_Door_Sync), "Setup")]
		public static class LG_Door_Sync__Setup__Patch
		{
			public static void Postfix(LG_Door_Sync __instance)
			{
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Expected O, but got Unknown
				//IL_00c2: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
				LG_SecurityDoor val = ((Il2CppObjectBase)__instance.m_core).TryCast<LG_SecurityDoor>();
				if ((Object)(object)val != (Object)null)
				{
					Transform val2 = ((Component)val).transform.Find("crossing");
					if ((Object)(object)val2 == (Object)null)
					{
						ManualLogSource l = Plugin.L;
						bool flag = default(bool);
						BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(43, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("SecurityDoor with no 'crossing' child GO?: ");
							((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(((Object)val).name);
						}
						l.LogWarning(val3);
					}
					else
					{
						val2.localScale = INVERT_X;
					}
					return;
				}
				LG_WeakDoor val4 = ((Il2CppObjectBase)__instance.m_core).TryCast<LG_WeakDoor>();
				if (!((Object)(object)val4 != (Object)null))
				{
					return;
				}
				((Component)val4.m_doorBladeCuller).transform.localScale = INVERT_X;
				foreach (BoxCollider componentsInChild in ((Component)val4.m_doorBladeCuller).GetComponentsInChildren<BoxCollider>())
				{
					((Component)componentsInChild).transform.localScale = Vector3.Scale(((Component)componentsInChild).transform.localScale, INVERT_X);
				}
			}
		}

		[HarmonyPatch(typeof(InputMapper), "DoGetAxis")]
		public static class InputMapper__DoGetAxis__Patch
		{
			public static void Postfix(InputMapper __instance, InputAction action, ref float __result)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Invalid comparison between Unknown and I4
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Invalid comparison between Unknown and I4
				//IL_0004: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Invalid comparison between Unknown and I4
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Invalid comparison between Unknown and I4
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Invalid comparison between Unknown and I4
				if ((int)action == 1 || (int)action == 3)
				{
					eFocusState currentState = FocusStateManager.CurrentState;
					if ((int)currentState == 4 || currentState - 6 <= 1 || ((int)currentState == 13 && ((Behaviour)CM_PageMap.Current).isActiveAndEnabled))
					{
						__result *= -1f;
					}
				}
			}
		}

		[HarmonyPatch(typeof(FirstPersonItemHolder), "Setup")]
		public static class FirstPersonItemHolder__Setup__Patch
		{
			public static void Postfix(FirstPersonItemHolder __instance)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				((Component)__instance).transform.localScale = INVERT_X;
				Enumerator<BackpackItem> enumerator = PlayerBackpackManager.GetBackpack(SNet.LocalPlayer).BackpackItems.GetEnumerator();
				while (enumerator.MoveNext())
				{
					BackpackItem current = enumerator.Current;
					if (!((Object)(object)current.Instance == (Object)null))
					{
						((Component)current.Instance).transform.localScale = Vector3.one;
					}
				}
			}
		}

		[HarmonyPatch(typeof(PlayerFPSBody), "SetLeftArmTargetPosRot")]
		public static class PlayerFPSBody__SetLeftArmTargetPosRot__Patch
		{
			public static bool Prefix(PlayerFPSBody __instance, Transform targetTrans)
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)targetTrans == (Object)null)
				{
					return false;
				}
				__instance.m_tempRot = targetTrans.rotation;
				__instance.m_tempRot *= Quaternion.Euler(__instance.m_leftHandIKRotOffset);
				__instance.m_leftHandIKTarget.SetPositionAndRotation(targetTrans.position + -1f * targetTrans.right * __instance.m_leftHandIKPosOffset.x + targetTrans.up * __instance.m_leftHandIKPosOffset.y + targetTrans.forward * __instance.m_leftHandIKPosOffset.z, __instance.m_tempRot);
				return false;
			}
		}

		[HarmonyPatch(typeof(PlayerFPSBody), "SetRightArmTargetPosRot")]
		public static class PlayerFPSBody__SetRightArmTargetPosRot__Patch
		{
			public static bool Prefix(PlayerFPSBody __instance, Transform targetTrans)
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)targetTrans == (Object)null)
				{
					return false;
				}
				__instance.m_tempRot = targetTrans.rotation;
				__instance.m_tempRot *= Quaternion.Euler(__instance.m_rightHandIKRotOffset);
				__instance.m_rightHandIKTarget.SetPositionAndRotation(targetTrans.position + -1f * targetTrans.right * __instance.m_rightHandIKPosOffset.x + targetTrans.up * __instance.m_rightHandIKPosOffset.y + targetTrans.forward * __instance.m_rightHandIKPosOffset.z, __instance.m_tempRot);
				return false;
			}
		}

		public static Vector3 INVERT_X = new Vector3(-1f, 1f, 1f);
	}
	[BepInPlugin("dev.aurirex.gtfo.mirrormode", "Mirror_Mode", "1.1.0")]
	public class Plugin : BasePlugin
	{
		public const string GUID = "dev.aurirex.gtfo.mirrormode";

		public const string MOD_NAME = "Mirror_Mode";

		public const string VERSION = "1.1.0";

		internal static ManualLogSource L;

		private static readonly Harmony _harmony = new Harmony("dev.aurirex.gtfo.mirrormode");

		private static ApplyMirror _gameMirrorApplier;

		public override void Load()
		{
			L = ((BasePlugin)this).Log;
			ClassInjector.RegisterTypeInIl2Cpp<ApplyMirror>();
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
			L.LogInfo((object)"Plugin loaded!");
		}

		public static void SetGameMirror(bool active)
		{
			if (!((Object)(object)_gameMirrorApplier == (Object)null))
			{
				((Behaviour)_gameMirrorApplier).enabled = active;
			}
		}

		public static void SetGUIRootMirrored(bool active)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			GuiManager.Current.m_root.localScale = (active ? Patches.INVERT_X : Vector3.one);
		}

		internal static void ApplyShaderTo(FPSCamera camera)
		{
			if (!((Object)(object)camera == (Object)null))
			{
				GameObject gameObject = ((Component)camera).gameObject;
				if ((Object)(object)gameObject.GetComponent<ApplyMirror>() == (Object)null)
				{
					_gameMirrorApplier = gameObject.AddComponent<ApplyMirror>();
				}
			}
		}
	}
}