using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using EntityStates; using Microsoft.CodeAnalysis; using RoR2; using UnityEngine; using VRMod; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 VRAPI { public static class MotionControls { public delegate void SetHandPairEventHandler(CharacterBody body); public class HandController { internal HandController handController; public Transform transform => ((Component)handController).transform; public Transform muzzle => handController.muzzle; public Ray aimRay => handController.aimRay; public Animator animator => handController.animator; public RendererInfo[] rendererInfos => handController.rendererInfos; public Transform GetMuzzleByIndex(uint index) { return handController.GetMuzzleByIndex(index); } } public static SetHandPairEventHandler onHandPairSet; private static HandController _dominantHand; private static HandController _nonDominantHand; private static bool? _leftHanded; private static bool? _enabled; private static bool leftHanded { get { if (!_leftHanded.HasValue) { _leftHanded = ModConfig.LeftHanded; } return _leftHanded.Value; } } public static HandController dominantHand { get { if (_dominantHand == null) { _dominantHand = new HandController(); } if ((Object)(object)_dominantHand.handController == (Object)null) { _dominantHand.handController = MotionControls.GetHandByDominance(true); } return _dominantHand; } } public static HandController nonDominantHand { get { if (_nonDominantHand == null) { _nonDominantHand = new HandController(); } if ((Object)(object)_nonDominantHand.handController == (Object)null) { _nonDominantHand.handController = MotionControls.GetHandByDominance(false); } return _nonDominantHand; } } public static HandController leftHand { get { if (!leftHanded) { return nonDominantHand; } return dominantHand; } } public static HandController rightHand { get { if (!leftHanded) { return dominantHand; } return nonDominantHand; } } public static bool enabled { get { if (!_enabled.HasValue) { _enabled = ModConfig.MotionControlsEnabled; } return _enabled.Value; } } public static void AddHandPrefab(GameObject handPrefab) { MotionControls.AddHandPrefab(handPrefab); } public static void AddHandSkin(ScriptableObject handSkinDef) { if (!(handSkinDef is HandSkinDef)) { VRAPI.StaticLogger.LogError((object)"Cannot add hand skin: The scriptable object isn't of type HandSkinDef."); } MotionControls.AddHandSkin((HandSkinDef)(object)((handSkinDef is HandSkinDef) ? handSkinDef : null)); } public static void AddSkillBindingOverride(string bodyName, SkillSlot dominantTrigger, SkillSlot nonDominantTrigger, SkillSlot nonDominantGrip, SkillSlot dominantGrip) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) Controllers.AddSkillBindingOverride(bodyName, dominantTrigger, nonDominantTrigger, nonDominantGrip, dominantGrip); } [Obsolete("Deprecated. Use AddSkillBindingOverride instead.")] public static void AddSkillRemap(string bodyName, SkillSlot skill1, SkillSlot skill2) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Controllers.AddSkillRemap(bodyName, skill1, skill2); } } public static class Utils { private static CharacterMaster _cachedMaster; private static CharacterMaster localCharacterMaster { get { if (!Object.op_Implicit((Object)(object)_cachedMaster)) { _cachedMaster = LocalUserManager.GetFirstLocalUser().cachedMaster; } return _cachedMaster; } } public static bool IsInVR(this EntityState state) { return state.characterBody.master.IsInVR(); } public static bool IsInVR(this CharacterBody body) { return body.master.IsInVR(); } public static bool IsInVR(this CharacterMaster master) { if (VR.enabled) { return (Object)(object)master == (Object)(object)localCharacterMaster; } return false; } public static bool IsUsingMotionControls(this EntityState state) { if (state.characterBody.master.IsInVR()) { return MotionControls.enabled; } return false; } public static bool IsUsingMotionControls(this CharacterBody body) { if (body.master.IsInVR()) { return MotionControls.enabled; } return false; } public static bool IsUsingMotionControls(this CharacterMaster master) { if (master.IsInVR()) { return MotionControls.enabled; } return false; } } public static class VR { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.DrBibop.VRMod"); } return _enabled.Value; } } public static void AddVignetteState(Type stateType) { ConfortVignette.AddVignetteState(stateType); } public static void PreventRendererDisable(string bodyName, string rendererObjectName) { CameraFixes.PreventRendererDisable(bodyName, rendererObjectName); } } [BepInPlugin("com.DrBibop.VRAPI", "VRAPI", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class VRAPI : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static SetHandPairEventHandler <>9__2_0; internal void b__2_0(CharacterBody body) { if (MotionControls.onHandPairSet != null) { MotionControls.onHandPairSet(body); } } } internal static ManualLogSource StaticLogger; private void Awake() { StaticLogger = ((BaseUnityPlugin)this).Logger; if (VR.enabled && MotionControls.enabled) { SubscribeToHandPairEvent(); } } private void SubscribeToHandPairEvent() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown SetHandPairEventHandler onHandPairSet = MotionControls.onHandPairSet; object obj = <>c.<>9__2_0; if (obj == null) { SetHandPairEventHandler val = delegate(CharacterBody body) { if (MotionControls.onHandPairSet != null) { MotionControls.onHandPairSet(body); } }; <>c.<>9__2_0 = val; obj = (object)val; } MotionControls.onHandPairSet = (SetHandPairEventHandler)Delegate.Combine((Delegate?)(object)onHandPairSet, (Delegate?)obj); } } }