Decompiled source of SaveStatesCamUtils Right Stick Disable v1.0.1

plugins/SaveStatesPatch.dll

Decompiled 5 days 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.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SaveState;
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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("SaveStatesPatch")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Hotfix for Save States Cam Utils")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SaveStatesPatch")]
[assembly: AssemblyTitle("SaveStatesPatch")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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;
		}
	}
}
namespace SaveStatesPatch
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "SaveStatesPatch";

		public const string PLUGIN_NAME = "SaveStatesPatch";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace YourPatcherNamespace
{
	[BepInPlugin("com.Dragsun.savestatepatch", "SaveState Stick Fix", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class SaveStateStickFix : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("com.Dragsun.savestatepatch");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"SaveState Right Stick Patched: Successfully redirected JoystickButton9 to KeyCode.None");
		}
	}
	[HarmonyPatch(typeof(SaveStatePlugin), "Update")]
	public static class SaveStateUpdatePatch
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ldc_I4 && (int)list[i].operand == 339)
				{
					list[i].operand = 0;
					Debug.Log((object)"Patch: Replaced JoystickButton9 with KeyCode.None in SaveState.Update");
				}
			}
			return list.AsEnumerable();
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}