Decompiled source of BetterFaceRotation v1.0.1

BepInEx/plugins/BetterFaceRotation.dll

Decompiled 8 months 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 BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("BetterFaceRotation")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("BetterFaceRotation")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("BetterFaceRotation")]
[assembly: AssemblyTitle("BetterFaceRotation")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 BetterFaceRotation
{
	[ContentWarningPlugin("viviko.BetterFaceRotation", "BetterFaceRotation", true)]
	[BepInPlugin("viviko.BetterFaceRotation", "BetterFaceRotation", "1.0.1")]
	public class BetterFaceRotation : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(PlayerCustomizer))]
		internal class PlayerCustomizerPatch
		{
			[HarmonyPatch("RPCA_RotateFaceText")]
			[HarmonyTranspiler]
			private static IEnumerable<CodeInstruction> RPCA_RotateFaceTextTranspiler(IEnumerable<CodeInstruction> instructions)
			{
				List<CodeInstruction> list = new List<CodeInstruction>(instructions);
				for (int i = 0; i < list.Count; i++)
				{
					CodeInstruction val = list[i];
					if (!(val.opcode != OpCodes.Ldc_I4_S))
					{
						if ((sbyte)val.operand == -90)
						{
							val.operand = -15;
						}
						else if ((sbyte)val.operand == 90)
						{
							val.operand = 15;
						}
					}
				}
				return list.AsEnumerable();
			}

			[HarmonyPatch(/*Could not decode attribute arguments.*/)]
			[HarmonyTranspiler]
			private static IEnumerable<CodeInstruction> FaceRotationTranspiler(IEnumerable<CodeInstruction> instructions)
			{
				List<CodeInstruction> list = new List<CodeInstruction>(instructions);
				for (int i = 0; i < list.Count; i++)
				{
					CodeInstruction val = list[i];
					if (val.opcode == OpCodes.Ldc_I4_S && (sbyte)val.operand == 90)
					{
						val.operand = 15;
					}
					else if (val.opcode == OpCodes.Ldc_R4 && (float)val.operand == 90f)
					{
						val.operand = 15f;
					}
				}
				return list.AsEnumerable();
			}
		}

		private const string modGUID = "viviko.BetterFaceRotation";

		private const string modName = "BetterFaceRotation";

		private const string modVersion = "1.0.1";

		private const int angleToRotate = 15;

		private readonly Harmony harmony = new Harmony("viviko.BetterFaceRotation");

		public static BetterFaceRotation Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("viviko.BetterFaceRotation");
			harmony.PatchAll();
			mls.LogInfo((object)"Plugin BetterFaceRotation is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BetterFaceRotation";

		public const string PLUGIN_NAME = "BetterFaceRotation";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}