Decompiled source of CursorFreedom2 v1.0.0

plugins/CursorFreedom2.dll

Decompiled 3 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using On.RoR2;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CursorFreedom2")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+aa8ef4b1ba8bc68b7f54a8cfede973c12ee1b1ea")]
[assembly: AssemblyProduct("CursorFreedom2")]
[assembly: AssemblyTitle("CursorFreedom2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace CursorFreedom2;

[BepInPlugin("com.TheTimeSweeper.CursorFreedom2", "CursorFreedom2", "0.0.1")]
public class CursorFreedom2Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		RoR2Application.UpdateCursorState += new hook_UpdateCursorState(RoR2Application_UpdateCursorState);
		MPEventSystemManager.Update += new hook_Update(MPEventSystemManager_Update);
	}

	private void MPEventSystemManager_Update(orig_Update orig, MPEventSystemManager self)
	{
		orig.Invoke(self);
		Mutinize();
	}

	private void RoR2Application_UpdateCursorState(orig_UpdateCursorState orig)
	{
		orig.Invoke();
		Mutinize();
	}

	private void Mutinize()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Invalid comparison between Unknown and I4
		if ((int)Cursor.lockState == 2)
		{
			Cursor.lockState = (CursorLockMode)0;
		}
	}
}