Decompiled source of OffsetMod v1.2.0

Mods/OffsetMod.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.Json;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Utilities;
using MelonLoader;
using Microsoft.CodeAnalysis;
using OffsetMod;
using RumbleModdingAPI;
using UnityEngine;
using UnityEngine.InputSystem.XR;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(MainClass), "OffsetMod", "1.2.0", "Saveforth", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 246, 96, 223)]
[assembly: AssemblyTitle("OffsetMod")]
[assembly: AssemblyDescription("OffsetController")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Your Company")]
[assembly: AssemblyProduct("Your Product")]
[assembly: AssemblyCopyright("Copyright © Your Company Year")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace OffsetMod
{
	public class MainClass : MelonMod
	{
		private bool isSetup = false;

		private Vector3 offsets = new Vector3(0f, 0f, 0f);

		private GameObject lController;

		private GameObject rController;

		private GameObject nlc;

		private GameObject nrc;

		public override void OnLateInitializeMelon()
		{
			((MelonBase)this).OnLateInitializeMelon();
			Calls.onMapInitialized += offSet;
		}

		public void offSet()
		{
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			downloadOffsets();
			Transform child = ((Component)Singleton<PlayerManager>.instance.localPlayer.Controller).gameObject.transform.GetChild(1);
			lController = ((Component)((Component)Singleton<PlayerManager>.instance.localPlayer.Controller).gameObject.transform.GetChild(1).GetChild(1)).gameObject;
			rController = ((Component)((Component)Singleton<PlayerManager>.instance.localPlayer.Controller).gameObject.transform.GetChild(1).GetChild(2)).gameObject;
			TrackedPoseDriver component = lController.GetComponent<TrackedPoseDriver>();
			TrackedPoseDriver component2 = rController.GetComponent<TrackedPoseDriver>();
			nlc = Object.Instantiate<GameObject>(lController);
			nrc = Object.Instantiate<GameObject>(rController);
			nlc.transform.SetParent(child);
			nrc.transform.SetParent(child);
			((Behaviour)component).enabled = false;
			((Behaviour)component2).enabled = false;
			lController.transform.parent = nlc.transform;
			rController.transform.parent = nrc.transform;
			lController.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
			rController.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
			MelonLogger.Msg("offsets " + offsets.x + " " + offsets.y + " " + offsets.z);
			lController.transform.localPosition = offsets;
			rController.transform.localPosition = offsets;
			MelonLogger.Msg("offsets " + rController.transform.localPosition.x + " " + rController.transform.localPosition.y + " " + rController.transform.localPosition.z);
			isSetup = true;
		}

		public override void OnUpdate()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			if (isSetup)
			{
				lController.transform.localPosition = offsets;
				rController.transform.localPosition = offsets;
				lController.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
				rController.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
			}
			if (Input.GetKeyDown((KeyCode)107))
			{
				downloadOffsets();
			}
		}

		public void downloadOffsets()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			string path = "UserData/offsets.json";
			string json = File.ReadAllText(path);
			offsetData offsetData2 = JsonSerializer.Deserialize<offsetData>(json);
			offsets = new Vector3(offsetData2.x, offsetData2.y, offsetData2.z);
			MelonLogger.Msg("offsets " + offsets.x + " " + offsets.y + " " + offsets.z);
		}
	}
	public class offsetData
	{
		public float x { get; set; }

		public float y { get; set; }

		public float z { get; set; }
	}
}