using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PEAKUnbound.Patches;
using Unity.Mathematics;
using UnityEngine.InputSystem;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PEAKUnbound")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyInformationalVersion("1.4.0+32a915af2e5d75b295f7afa2b1b3105dfd4e3d92")]
[assembly: AssemblyProduct("PEAKUnbound")]
[assembly: AssemblyTitle("PeakUnbound")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 PEAKUnbound
{
[BepInPlugin("PEAKUnbound", "PeakUnbound", "1.4.0")]
public class Plugin : BaseUnityPlugin
{
public static Plugin instance = null;
private readonly Harmony _harmony = new Harmony("PEAKUnbound");
private static List<ConfigEntry<string>> simpleConfigList = new List<ConfigEntry<string>>();
private static Dictionary<ConfigEntry<string>, int> complexConfigList = new Dictionary<ConfigEntry<string>, int>();
internal static List<string> invalidActions = new List<string>(4) { "AnyKey", "OpenDebugMenu", "TrackedDevicePosition", "TrackedDeviceOrientation" };
internal static List<string> ValidValues = new List<string>(207)
{
"<Keyboard>/anyKey", "<Keyboard>/escape", "<Keyboard>/space", "<Keyboard>/enter", "<Keyboard>/tab", "<Keyboard>/backquote", "<Keyboard>/quote", "<Keyboard>/semicolon", "<Keyboard>/comma", "<Keyboard>/period",
"<Keyboard>/slash", "<Keyboard>/backslash", "<Keyboard>/leftBracket", "<Keyboard>/rightBracket", "<Keyboard>/minus", "<Keyboard>/equals", "<Keyboard>/upArrow", "<Keyboard>/downArrow", "<Keyboard>/leftArrow", "<Keyboard>/rightArrow",
"<Keyboard>/a", "<Keyboard>/b", "<Keyboard>/c", "<Keyboard>/d", "<Keyboard>/e", "<Keyboard>/f", "<Keyboard>/g", "<Keyboard>/h", "<Keyboard>/i", "<Keyboard>/j",
"<Keyboard>/k", "<Keyboard>/l", "<Keyboard>/m", "<Keyboard>/n", "<Keyboard>/o", "<Keyboard>/p", "<Keyboard>/q", "<Keyboard>/r", "<Keyboard>/s", "<Keyboard>/t",
"<Keyboard>/u", "<Keyboard>/v", "<Keyboard>/w", "<Keyboard>/x", "<Keyboard>/y", "<Keyboard>/z", "<Keyboard>/1", "<Keyboard>/2", "<Keyboard>/3", "<Keyboard>/4",
"<Keyboard>/5", "<Keyboard>/6", "<Keyboard>/7", "<Keyboard>/8", "<Keyboard>/9", "<Keyboard>/0", "<Keyboard>/leftShift", "<Keyboard>/rightShift", "<Keyboard>/shift", "<Keyboard>/leftAlt",
"<Keyboard>/rightAlt", "<Keyboard>/alt", "<Keyboard>/leftCtrl", "<Keyboard>/rightCtrl", "<Keyboard>/ctrl", "<Keyboard>/leftMeta", "<Keyboard>/rightMeta", "<Keyboard>/contextMenu", "<Keyboard>/backspace", "<Keyboard>/pageDown",
"<Keyboard>/pageUp", "<Keyboard>/home", "<Keyboard>/end", "<Keyboard>/insert", "<Keyboard>/delete", "<Keyboard>/capsLock", "<Keyboard>/numLock", "<Keyboard>/printScreen", "<Keyboard>/scrollLock", "<Keyboard>/pause",
"<Keyboard>/numpadEnter", "<Keyboard>/numpadDivide", "<Keyboard>/numpadMultiply", "<Keyboard>/numpadPlus", "<Keyboard>/numpadMinus", "<Keyboard>/numpadPeriod", "<Keyboard>/numpadEquals", "<Keyboard>/numpad1", "<Keyboard>/numpad2", "<Keyboard>/numpad3",
"<Keyboard>/numpad4", "<Keyboard>/numpad5", "<Keyboard>/numpad6", "<Keyboard>/numpad7", "<Keyboard>/numpad8", "<Keyboard>/numpad9", "<Keyboard>/numpad0", "<Keyboard>/f1", "<Keyboard>/f2", "<Keyboard>/f3",
"<Keyboard>/f4", "<Keyboard>/f5", "<Keyboard>/f6", "<Keyboard>/f7", "<Keyboard>/f8", "<Keyboard>/f9", "<Keyboard>/f10", "<Keyboard>/f11", "<Keyboard>/f12", "<Keyboard>/OEM1",
"<Keyboard>/OEM2", "<Keyboard>/OEM3", "<Keyboard>/OEM4", "<Keyboard>/OEM5", "<Keyboard>/IMESelected", "<Mouse>/position", "<Mouse>/delta", "<Mouse>/scroll", "<Mouse>/press", "<Mouse>/leftButton",
"<Mouse>/rightButton", "<Mouse>/middleButton", "<Mouse>/forwardButton", "<Mouse>/backButton", "<Mouse>/pressure", "<Mouse>/radius", "<Mouse>/pointerId", "<Mouse>/displayIndex", "<Mouse>/clickCount", "<Mouse>/position/x",
"<Mouse>/position/y", "<Mouse>/delta/up", "<Mouse>/delta/down", "<Mouse>/delta/left", "<Mouse>/delta/right", "<Mouse>/delta/x", "<Mouse>/delta/y", "<Mouse>/scroll/up", "<Mouse>/scroll/down", "<Mouse>/scroll/left",
"<Mouse>/scroll/right", "<Mouse>/scroll/x", "<Mouse>/scroll/y", "<Mouse>/radius/x", "<Mouse>/radius/y", "<Pen>/position", "<Pen>/delta", "<Pen>/tilt", "<Pen>/pressure", "<Pen>/twist",
"<Pen>/tip", "<Pen>/press", "<Pen>/eraser", "<Pen>/inRange", "<Pen>/barrel1", "<Pen>/barrel2", "<Pen>/barrel3", "<Pen>/barrel4", "<Pen>/radius", "<Pen>/pointerId",
"<Pen>/displayIndex", "<Pen>/position/x", "<Pen>/position/y", "<Pen>/delta/up", "<Pen>/delta/down", "<Pen>/delta/left", "<Pen>/delta/right", "<Pen>/delta/x", "<Pen>/delta/y", "<Pen>/tilt/x",
"<Pen>/tilt/y", "<Pen>/radius/x", "<Pen>/radius/y", "<Gamepad>/dpad", "<Gamepad>/start", "<Gamepad>/select", "<Gamepad>/leftStickPress", "<Gamepad>/rightStickPress", "<Gamepad>/leftShoulder", "<Gamepad>/rightShoulder",
"<Gamepad>/buttonSouth", "<Gamepad>/buttonEast", "<Gamepad>/buttonWest", "<Gamepad>/buttonNorth", "<Gamepad>/leftTrigger", "<Gamepad>/rightTrigger", "<Gamepad>/leftStick", "<Gamepad>/rightStick", "<Gamepad>/dpad/x", "<Gamepad>/dpad/y",
"<Gamepad>/dpad/up", "<Gamepad>/dpad/down", "<Gamepad>/dpad/left", "<Gamepad>/dpad/right", "<Gamepad>/leftStick/up", "<Gamepad>/leftStick/x", "<Gamepad>/leftStick/y", "<Gamepad>/leftStick/down", "<Gamepad>/leftStick/left", "<Gamepad>/leftStick/right",
"<Gamepad>/rightStick/up", "<Gamepad>/rightStick/x", "<Gamepad>/rightStick/y", "<Gamepad>/rightStick/down", "<Gamepad>/rightStick/left", "<Gamepad>/rightStick/right", "Dpad"
};
public const string Id = "PEAKUnbound";
internal static ManualLogSource Log { get; private set; } = null;
public static string Name => "PeakUnbound";
public static string Version => "1.4.0";
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
_harmony.PatchAll(typeof(ControllerSensitivitySettingGetMinMaxValuePatch));
CreateConfigBindings();
CollectionExtensions.Do<ConfigEntry<string>>((IEnumerable<ConfigEntry<string>>)simpleConfigList, (Action<ConfigEntry<string>>)delegate(ConfigEntry<string> x)
{
Rebind(x);
});
CollectionExtensions.Do<KeyValuePair<ConfigEntry<string>, int>>((IEnumerable<KeyValuePair<ConfigEntry<string>, int>>)complexConfigList, (Action<KeyValuePair<ConfigEntry<string>, int>>)delegate(KeyValuePair<ConfigEntry<string>, int> x)
{
RebindComplex(x);
});
((BaseUnityPlugin)this).Config.SettingChanged += OnSettingChanged;
((BaseUnityPlugin)this).Config.ConfigReloaded += OnConfigReloaded;
}
public void OnSettingChanged(object sender, SettingChangedEventArgs settingChangedArg)
{
if (settingChangedArg.ChangedSetting != null)
{
ConfigEntry<string> val = (ConfigEntry<string>)(object)settingChangedArg.ChangedSetting;
if (val != null)
{
Log.LogDebug((object)("CONFIG SETTING CHANGE EVENT - " + settingChangedArg.ChangedSetting.Definition.Key));
ConfigEntryRebind(val);
}
}
}
public void ConfigEntryRebind(ConfigEntry<string> entryGiven)
{
ConfigEntry<string> entryGiven2 = entryGiven;
if (!ValidValues.Contains(entryGiven2.Value))
{
return;
}
if (simpleConfigList.Contains(entryGiven2))
{
Rebind(entryGiven2);
}
if (complexConfigList.ContainsKey(entryGiven2))
{
KeyValuePair<ConfigEntry<string>, int> entryGiven3 = complexConfigList.FirstOrDefault<KeyValuePair<ConfigEntry<string>, int>>((KeyValuePair<ConfigEntry<string>, int> x) => x.Key == entryGiven2);
RebindComplex(entryGiven3);
}
}
public void OnConfigReloaded(object sender, EventArgs e)
{
Log.LogDebug((object)"Config has been reloaded!");
}
public static void RebindComplex(KeyValuePair<ConfigEntry<string>, int> entryGiven)
{
if (entryGiven.Key == null)
{
Log.LogError((object)"Null config setting provided!!!");
return;
}
Log.LogDebug((object)("Processing binding for " + ((ConfigEntryBase)entryGiven.Key).Definition.Key));
if (!ValidValues.Contains(entryGiven.Key.Value))
{
Log.LogWarning((object)$"Unable to bind {((ConfigEntryBase)entryGiven.Key).Definition.Key} to {entryGiven.Value} (INVALID VALUE)");
return;
}
string text = ((ConfigEntryBase)entryGiven.Key).Definition.Key.Substring(0, ((ConfigEntryBase)entryGiven.Key).Definition.Key.IndexOf(';'));
int value = entryGiven.Value;
InputAction inputAction = InputSystem.actions.FindAction(text, false);
SetAction(inputAction, ((ConfigEntryBase)entryGiven.Key).Definition.Key, entryGiven.Key.Value, value);
}
public static void Rebind(ConfigEntry<string> entryGiven)
{
if (entryGiven == null)
{
Log.LogError((object)"Null config setting provided!!!");
return;
}
Log.LogDebug((object)("Processing binding for " + ((ConfigEntryBase)entryGiven).Definition.Key));
if (!ValidValues.Contains(entryGiven.Value))
{
Log.LogWarning((object)("Unable to bind " + ((ConfigEntryBase)entryGiven).Definition.Key + " to " + entryGiven.Value + " (INVALID VALUE)"));
}
else
{
InputAction inputAction = InputSystem.actions.FindAction(((ConfigEntryBase)entryGiven).Definition.Key, false);
SetAction(inputAction, ((ConfigEntryBase)entryGiven).Definition.Key, entryGiven.Value);
}
}
public static void SetAction(InputAction inputAction, string Name, string Value, int index = 0)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
if (inputAction == null)
{
Log.LogError((object)("Unable to find inputAction for " + Name));
return;
}
BindingSyntax val = InputActionSetupExtensions.ChangeBinding(inputAction, index);
((BindingSyntax)(ref val)).WithPath(Value);
Log.LogMessage((object)("Updated binding for " + Name + " with " + Value));
}
public void CreateConfigBindings()
{
complexConfigList = new Dictionary<ConfigEntry<string>, int>();
simpleConfigList = new List<ConfigEntry<string>>();
CollectionExtensions.Do<InputAction>((IEnumerable<InputAction>)InputSystem.actions, (Action<InputAction>)delegate(InputAction action)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_026d: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_0242: Unknown result type (might be due to invalid IL or missing references)
//IL_0328: Unknown result type (might be due to invalid IL or missing references)
//IL_032d: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_0336: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: 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_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: 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)
if (action.bindings.Count != 0 && !invalidActions.Contains(action.name))
{
Log.LogDebug((object)("Processing InputAction - " + action.name));
InputBinding val;
if (action.bindings.Count > 1)
{
for (int i = 0; i < action.bindings.Count; i++)
{
List<string> validValues = ValidValues;
val = action.bindings[i];
if (validValues.Contains(((InputBinding)(ref val)).effectivePath))
{
string text = "General";
string text2 = "";
val = action.bindings[i];
if (((InputBinding)(ref val)).effectivePath.Contains("/"))
{
val = action.bindings[i];
int num = ((InputBinding)(ref val)).effectivePath.IndexOf('/');
val = action.bindings[i];
text = ((InputBinding)(ref val)).effectivePath.Substring(0, num).Replace("<", "").Replace(">", "");
val = action.bindings[i];
string effectivePath = ((InputBinding)(ref val)).effectivePath;
int num2 = num;
text2 = effectivePath.Substring(num2, effectivePath.Length - num2).Replace("/", "");
}
else
{
val = action.bindings[i];
if (((InputBinding)(ref val)).effectivePath == "Dpad")
{
text = "Gamepad";
}
val = action.bindings[i];
text2 = ((InputBinding)(ref val)).effectivePath;
}
ConfigFile config = ((BaseUnityPlugin)this).Config;
string text3 = text;
string text4 = action.name + "; " + text2;
val = action.bindings[i];
ConfigEntry<string> key = config.Bind<string>(text3, text4, ((InputBinding)(ref val)).effectivePath, $"Change binding for {action.name} ({i}).\nThis is an action with multiple bindings.");
complexConfigList.Add(key, i);
}
}
}
else
{
string text5 = "General";
val = action.bindings[0];
if (((InputBinding)(ref val)).effectivePath.Contains("/"))
{
val = action.bindings[0];
string effectivePath2 = ((InputBinding)(ref val)).effectivePath;
val = action.bindings[0];
text5 = effectivePath2.Substring(0, ((InputBinding)(ref val)).effectivePath.IndexOf('/')).Replace("<", "").Replace(">", "");
}
else
{
val = action.bindings[0];
if (((InputBinding)(ref val)).effectivePath == "Dpad")
{
text5 = "Gamepad";
}
}
ConfigFile config2 = ((BaseUnityPlugin)this).Config;
string text6 = text5;
string name = action.name;
val = action.bindings[0];
ConfigEntry<string> item = config2.Bind<string>(text6, name, ((InputBinding)(ref val)).effectivePath, "Change binding for " + action.name + " (" + text5 + ").\nThis is an action with a single binding");
simpleConfigList.Add(item);
}
}
});
}
}
}
namespace PEAKUnbound.Patches
{
public class ControllerSensitivitySettingGetMinMaxValuePatch
{
[HarmonyPatch(typeof(ControllerSensitivitySetting), "GetMinMaxValue")]
[HarmonyPrefix]
private static bool Prefix(ref float2 __result)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
__result = new float2(0.1f, 20f);
return false;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}