Decompiled source of LeftPoseHandFix v1.0.1

Mods/LeftPoseFix.dll

Decompiled 3 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppRUMBLE.Input;
using Il2CppRUMBLE.Players.Subsystems;
using Il2CppRUMBLE.Poses;
using Il2CppSystem.Collections.Generic;
using LeftPoseFix;
using MelonLoader;
using RumbleModdingAPI.RMAPI;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Main), "LeftPoseFix", "1.0.1", "GreyBeetle", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 0, 255, 255)]
[assembly: MelonAuthorColor(255, 0, 255, 255)]
[assembly: VerifyLoaderVersion(0, 6, 2, true)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace LeftPoseFix;

public class Main : MelonMod
{
	[HarmonyPatch(typeof(PlayerHandPresence), "UpdateHandPresenceAnimationStates")]
	private class Patch
	{
		private static void Prefix(ref PlayerHandPresence __instance, ref Hand hand, ref HandPresenceInput input)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			if (sceneLoading || (Object)(object)((Component)__instance).transform.parent != (Object)(object)((Component)Players.GetLocalPlayerController()).transform)
			{
				return;
			}
			bool flag = false;
			for (int i = 0; i < inputSources.Count; i++)
			{
				Il2CppReferenceArray<PoseConfiguration> configurations = inputSources[i].poseSet.configurations;
				PoseData pose = ((Il2CppArrayBase<PoseConfiguration>)(object)configurations)[((Il2CppArrayBase<PoseConfiguration>)(object)configurations).Count - 1].Pose;
				PoseComparisonResult val = pose.IsDoingPose(Players.GetLocalPlayerController(), (ComparisonMethod)2);
				if (((PoseComparisonResult)(ref val)).IsValidPose)
				{
					flag = true;
				}
			}
			if (flag)
			{
				input = new HandPresenceInput(1f, 1f, 1f, 0f);
			}
		}
	}

	public static List<PoseInputSource> inputSources;

	public static bool sceneLoading = true;

	public override void OnLateInitializeMelon()
	{
		Actions.onMapInitialized += delegate
		{
			inputSources = ((Component)((Component)Players.GetLocalPlayerController()).gameObject.transform).GetComponentInChildren<PlayerPoseSystem>().currentInputPoses;
			sceneLoading = false;
		};
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		sceneLoading = true;
	}
}