Decompiled source of ScrollInverter v0.0.1

ScrollInverter.dll

Decompiled a year ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ScrollInverter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ScrollInverter")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2EFB770B-4B3A-43ED-9914-EDA4DC74D9F1")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ScrollInverter;

[BepInPlugin("ScrollInverted", "Scroll Inverted", "0.0.1")]
public class ScrollInverter : BaseUnityPlugin
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	public class PlayerControllerBPatches
	{
		[HarmonyPatch("ScrollMouse_performed")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> Invert_ScrollMouse(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return new CodeMatcher(instructions, (ILGenerator)null).SearchForward((Func<CodeInstruction, bool>)((CodeInstruction instruction) => instruction.opcode.Name == OpCodes.Ble_Un.Name)).ThrowIfInvalid("Could not find branch instruction").SetOpcodeAndAdvance(OpCodes.Bge_Un_S)
				.InstructionEnumeration();
		}
	}

	private const string ID = "ScrollInverted";

	private const string NAME = "Scroll Inverted";

	private const string VERSION = "0.0.1";

	private static Harmony _Harmony;

	private static ManualLogSource _Log;

	private void Awake()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Expected O, but got Unknown
		_Log = ((BaseUnityPlugin)this).Logger;
		_Harmony = new Harmony("ScrollInverted");
		_Harmony.PatchAll();
		_Log.LogInfo((object)"Plugin ScrollInverted was loaded!");
	}
}