Decompiled source of LCVR Bugfixes v1.0.1

LCVR-bugfixes.dll

Decompiled 21 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LCVR-bugfixes")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LCVR-bugfixes")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("889c6544-baaa-4ea4-a04d-12cbd9199361")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LCVR_bugfixes;

[BepInPlugin("CubeMath.LCVRBugfixes", "LCVR Bugfixes", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class LCVR_bugfixes : BaseUnityPlugin
{
	private const string modGUID = "CubeMath.LCVRBugfixes";

	private const string modName = "LCVR Bugfixes";

	private const string modVersion = "1.0.1";

	private readonly Harmony harmony = new Harmony("CubeMath.LCVRBugfixes");

	private void Start()
	{
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Expected O, but got Unknown
		Type type = AccessTools.TypeByName("LCVR.UI.Spectating.SpectatingMenu");
		if (type == null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Failed to init LCVR Bugfixes.");
			return;
		}
		HarmonyMethod val = new HarmonyMethod(AccessTools.Method(typeof(SpectatingMenuPatch), "Transpiler", (Type[])null, (Type[])null));
		MethodInfo methodInfo = AccessTools.Method(type, "HandleGaze", (Type[])null, (Type[])null);
		MethodInfo methodInfo2 = AccessTools.Method(type, "CreateRayReceiver", (Type[])null, (Type[])null);
		harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null);
		harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Nutcrackers are no longer blind towards VR people.");
	}
}
public static class SpectatingMenuPatch
{
	public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
	{
		List<CodeInstruction> list = new List<CodeInstruction>(instructions);
		foreach (CodeInstruction item in list)
		{
			if (item.opcode == OpCodes.Ldc_I4 || item.opcode == OpCodes.Ldc_I4_S)
			{
				switch (Convert.ToInt32(item.operand))
				{
				case 25:
					item.operand = 26;
					break;
				case 33554432:
					item.operand = 67108864;
					break;
				}
			}
		}
		return list.AsEnumerable();
	}
}