using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Sirdoggy.TweakJumpButton.Common;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("Sirdoggy2")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Easier jumping in streamlined controls (for Twinstick/Armswinger)")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Sirdoggy.TweakJumpButton")]
[assembly: AssemblyTitle("Jump_On_Joystick_Click")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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.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]
[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;
}
}
[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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace Sirdoggy.TweakJumpButton
{
[BepInProcess("h3vr.exe")]
[BepInPlugin("Sirdoggy.TweakJumpButton", "Jump_On_Joystick_Click", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Log;
internal static ExceptionCatcher ExceptionCatcher;
public const string Id = "Sirdoggy.TweakJumpButton";
public static string Name => "Jump_On_Joystick_Click";
public static string Version => "1.0.0";
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
ExceptionCatcher = new ExceptionCatcher(Log);
ExceptionCatcher.Run(delegate
{
Harmony.CreateAndPatchAll(typeof(Patcher), (string)null);
});
}
}
internal static class Patcher
{
[HarmonyPostfix]
[HarmonyPatch(typeof(FVRMovementManager), "UpdateMovementWithHand")]
private static void UpdateMovementWithHand_Postfix(FVRMovementManager __instance, FVRViveHand hand)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: 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_001f: Invalid comparison between Unknown and I4
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Invalid comparison between Unknown and I4
if (!((Object)(object)__instance == (Object)null) && hand.IsInStreamlinedMode)
{
MovementMode mode = __instance.Mode;
if ((int)mode != 0 && (int)mode != 3 && (int)mode != 5 && hand.Input.TouchpadDown)
{
__instance.Jump();
}
}
}
}
}
namespace Sirdoggy.TweakJumpButton.Common
{
internal class ExceptionCatcher
{
private readonly ManualLogSource _log;
public ExceptionCatcher(ManualLogSource log)
{
_log = log;
}
public void Run(Action action, Action<Exception>? customHandler = null)
{
try
{
action();
}
catch (Exception ex)
{
if (customHandler == null)
{
_log.LogError((object)$"Caught unhandled exception: {ex}");
}
else
{
customHandler(ex);
}
}
}
}
}