using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using FlatPlayer; using HandReset; using MelonLoader; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("HandReset")] [assembly: AssemblyDescription("B key hand reset for FlatPlayer")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HandReset")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b2c3d4e5-f6a7-8901-bcde-f12345678901")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: MelonInfo(typeof(HandResetMod), "HandReset", "1.0.0", "zekeg", null)] [assembly: MelonPriority(0)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyVersion("1.0.0.0")] namespace HandReset; public class HandResetMod : MelonMod { private FieldInfo _fRPos; private FieldInfo _fLPos; private FieldInfo _fRRot; private FieldInfo _fLRot; private FieldInfo _fRDef; private FieldInfo _fLDef; private FieldInfo _fRIsRot; private FieldInfo _fLIsRot; private FlatBooter _instance; private static readonly Vector3 DEFAULT_RIGHT_POS = new Vector3(0.2f, -0.2f, 0.3f); private static readonly Quaternion DEFAULT_RIGHT_ROT = new Quaternion(0.2793f, -0.0586f, -0.0171f, -0.9583f); private static readonly Vector3 DEFAULT_LEFT_POS = new Vector3(-0.2f, -0.2f, 0.3f); private static readonly Quaternion DEFAULT_LEFT_ROT = new Quaternion(-0.2793f, -0.0586f, -0.0171f, 0.9583f); private object GetVal(FieldInfo f) { if (f == null) { return null; } if (!f.IsStatic) { return f.GetValue(_instance); } return f.GetValue(null); } private void SetVal(FieldInfo f, object val) { if (!(f == null)) { if (f.IsStatic) { f.SetValue(null, val); } else { f.SetValue(_instance, val); } } } public override void OnInitializeMelon() { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; Type typeFromHandle = typeof(FlatBooter); _fRPos = typeFromHandle.GetField("rightHandPos", bindingAttr); _fLPos = typeFromHandle.GetField("leftHandPos", bindingAttr); _fRRot = typeFromHandle.GetField("rightHandRot", bindingAttr); _fLRot = typeFromHandle.GetField("leftHandRot", bindingAttr); _fRDef = typeFromHandle.GetField("rightHandDef", bindingAttr); _fLDef = typeFromHandle.GetField("leftHandDef", bindingAttr); _fRIsRot = typeFromHandle.GetField("rightHandIsRotate", bindingAttr); _fLIsRot = typeFromHandle.GetField("leftHandIsRotate", bindingAttr); FieldInfo field = typeFromHandle.GetField("Instance", bindingAttr); if (field != null) { ref FlatBooter instance = ref _instance; object? value = field.GetValue(null); instance = (FlatBooter)((value is FlatBooter) ? value : null); } MelonLogger.Msg("HandReset loaded. Press B to reset hands to defaults."); } public override void OnUpdate() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (_instance != null && Input.GetKeyDown((KeyCode)98)) { SetVal(_fRPos, DEFAULT_RIGHT_POS); SetVal(_fLPos, DEFAULT_LEFT_POS); SetVal(_fRRot, DEFAULT_RIGHT_ROT); SetVal(_fLRot, DEFAULT_LEFT_ROT); SetVal(_fRIsRot, false); SetVal(_fLIsRot, false); MelonLogger.Msg("Hands reset to defaults + movement OFF."); } } }