Decompiled source of HipUnlocker v1.0.0

HipUnlocker.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using MoveClasses;
using UnityEngine;
using Utils;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("AutoTranslator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AutoTranslator")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("45edeae4-b07c-4a26-97ba-1357e778efdd")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HipUnlocker;

[BepInPlugin("com.morsecodeguy.hipunlocker", "HipUnlocker", "1.0.0")]
public class HipUnlockerPlugin : 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.morsecodeguy.hipunlocker");
		val.PatchAll();
		MoveSetHelpers.hipRotationMax = 360f;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"HipUnlocker loaded: Full hip rotation enabled!");
	}
}
[HarmonyPatch(typeof(SimplePositionAndRotationRig), "CalculatePosition")]
public class SimplePositionAndRotationRig_CalculatePosition_Patch
{
	[HarmonyPostfix]
	public static void Postfix(SimplePositionAndRotationRig __instance)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Invalid comparison between Unknown and I4
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		if ((int)((SimpleRig)__instance).jointTypeBase == 0)
		{
			Quaternion rotation = ((SimpleRig)__instance).target.rotation;
			Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
			if (eulerAngles.x > 180f)
			{
				eulerAngles.x -= 360f;
			}
			if (eulerAngles.y > 180f)
			{
				eulerAngles.y -= 360f;
			}
			if (eulerAngles.z > 180f)
			{
				eulerAngles.z -= 360f;
			}
			((SimpleRig)__instance).boneBase.eulerAngles = eulerAngles;
		}
	}
}
[HarmonyPatch(typeof(MoveSetEditor), "RotateJoint")]
public class MoveSetEditor_RotateJoint_Patch
{
	[HarmonyPrefix]
	public static bool Prefix(MoveSetEditor __instance, Vector3 rotation)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Invalid comparison between Unknown and I4
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Invalid comparison between Unknown and I4
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Expected O, but got Unknown
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		if (__instance.usingIKRig && __instance.selectedRigTarget != null && (int)__instance.selectedRigTarget.Rig.jointTypeBase == 0)
		{
			__instance.selectedRigTarget.GameObject.transform.Rotate(rotation, (Space)1);
			return false;
		}
		if (__instance.selectedJoint != null && (int)__instance.selectedJoint.JointType == 0)
		{
			__instance.selectedJoint.AnimationJoint.transform.Rotate(rotation, (Space)1);
			if (__instance.selectedSingleMove != null)
			{
				__instance.selectedSingleMove.targetRotation = new NullableVector3((float?)null, (float?)null, (float?)null);
				__instance.selectedSingleMove.targetRotation.x = __instance.selectedJoint.AnimationJoint.transform.localEulerAngles.x;
				__instance.selectedSingleMove.targetRotation.y = __instance.selectedJoint.AnimationJoint.transform.localEulerAngles.y;
				__instance.selectedSingleMove.targetRotation.z = __instance.selectedJoint.AnimationJoint.transform.localEulerAngles.z;
				__instance.UpdateSingleMoveEditor(__instance.selectedSingleMove);
			}
			else
			{
				Traverse.Create((object)__instance).Method("SetTempSingleMoveRotation", Array.Empty<object>()).GetValue();
			}
			return false;
		}
		return true;
	}
}