Decompiled source of SilksongAdaptiveTriggers v1.0.1
SilksongAdaptiveTriggers.dll
Decompiled 2 days agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using DSX_UDP_Example; using DualSenseBridge; using HarmonyLib; using InControl; using Silksong.ModMenu.Plugin; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("SilksongAdaptiveTriggers")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SilksongAdaptiveTriggers")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9b299c30-d723-4319-a098-5468b36bfe83")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] internal enum InternalTriggerMode { Normal, GameCube, VerySoft, Soft, Hard, VeryHard, Hardest, Rigid, VibrateTrigger, Choppy, Medium, VibrateTriggerPulse, CustomTriggerValue, Resistance, Bow, Galloping, SemiAutomaticGun, AutomaticGun, Machine, VIBRATE_TRIGGER_10Hz, OFF, FEEDBACK, WEAPON, VIBRATION, SLOPE_FEEDBACK, MULTIPLE_POSITION_FEEDBACK, MULTIPLE_POSITION_VIBRATION } public enum PlayerState { None, Dash, Sprint, Hook, ChargeSuperJump, SuperJump, Eject } [BepInPlugin("org.CheezyPants12.SilksongAT", "Silksong Adaptive Triggers", "1.0.0")] public class SilksongAdaptiveTriggers : BaseUnityPlugin { public static SilksongAdaptiveTriggers Instance; private ConfigEntry<int> SilkSoarTriggerStrength; private ConfigEntry<int> DashTriggerStrength; private ConfigEntry<int> SprintTriggerStrength; private ConfigEntry<int> ClawlineTriggerStrength; private void Awake() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown SilkSoarTriggerStrength = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Silk Soar Strength", 2, new ConfigDescription("The Vibration Strength of the AT During Silk Soar Charge.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 8), new object[1] { MenuElementGenerators.CreateIntSliderGenerator() })); DashTriggerStrength = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Dash Resistance", 8, new ConfigDescription("The Resistance of the AT While Dashing.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 8), new object[1] { MenuElementGenerators.CreateIntSliderGenerator() })); SprintTriggerStrength = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Sprint Frequency", 2, new ConfigDescription("The Vibration Frequency of the AT While Sprinting.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 40), new object[1] { MenuElementGenerators.CreateIntSliderGenerator() })); ClawlineTriggerStrength = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Clawline Resistance", 4, new ConfigDescription("The Resistance of the AT When Activating Clawline.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 8), new object[1] { MenuElementGenerators.CreateIntSliderGenerator() })); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin loaded and initialized."); Bridge.Init(); Harmony.CreateAndPatchAll(typeof(SilksongAdaptiveTriggers), (string)null); Instance = this; } public static void SetTriggerStateRight(PlayerState State) { switch (State) { case PlayerState.None: Bridge.ResetRightTrigger(); break; case PlayerState.Dash: Bridge.SendSlope((Trigger)2, (TriggerMode)24, 1, 9, Instance.DashTriggerStrength.Value, 1); break; case PlayerState.Sprint: Bridge.SendGallop((Trigger)2, (TriggerMode)15, 1, 9, 3, 6, Instance.SprintTriggerStrength.Value); break; } } public static void SetTriggerStateLeft(PlayerState State) { switch (State) { case PlayerState.None: Bridge.ResetLeftTrigger(); break; case PlayerState.Hook: Bridge.SendBow((Trigger)1, (TriggerMode)14, 1, 8, Instance.ClawlineTriggerStrength.Value, 8); break; case PlayerState.ChargeSuperJump: Bridge.SendVibration((Trigger)1, (TriggerMode)23, 2, Instance.SilkSoarTriggerStrength.Value, 40); break; } } [HarmonyPrefix] [HarmonyPatch(typeof(HeroController), "Update")] private static void UpdatePostFix() { GetSprintFlags(); } public static void GetSprintFlags() { if (HeroController.instance.cState.isSprinting) { if (!HeroController.instance.cState.dashing) { SetTriggerStateRight(PlayerState.Sprint); } else { SetTriggerStateRight(PlayerState.Dash); } } else if (HeroController.instance.cState.dashing) { SetTriggerStateRight(PlayerState.Dash); } } [HarmonyPrefix] [HarmonyPatch(typeof(HeroController), "LookForInput")] private static void LookForInputPostFix() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 HeroController instance = HeroController.instance; GameManager instance2 = GameManager.instance; if (instance.IsInputBlocked() || (int)instance2.GameState != 4 || instance2.isPaused || !GameManager.instance.IsGameplayScene()) { return; } if (((OneAxisInputControl)instance2.inputHandler.inputActions.SuperDash).IsPressed && ((OneAxisInputControl)instance2.inputHandler.inputActions.Down).IsPressed && !((OneAxisInputControl)instance2.inputHandler.inputActions.Up).IsPressed && !((OneAxisInputControl)instance2.inputHandler.inputActions.Left).IsPressed && !((OneAxisInputControl)instance2.inputHandler.inputActions.Right).IsPressed && instance.CanSuperJump()) { if (instance.controlReqlinquished) { } SetTriggerStateLeft(PlayerState.ChargeSuperJump); } if (instance.acceptingInput) { } } [HarmonyPrefix] [HarmonyPatch(typeof(HeroController), "LookForQueueInput")] private static void LookForQueueInputPostFix() { HeroController instance = HeroController.instance; GameManager instance2 = GameManager.instance; if (!instance.IsInputBlocked() && !((Object)(object)InteractManager.BlockingInteractable != (Object)null) && !instance.IsPaused() && GameManager.instance.IsGameplayScene() && ((OneAxisInputControl)instance2.inputHandler.inputActions.SuperDash).IsPressed && (!((OneAxisInputControl)instance2.inputHandler.inputActions.Down).IsPressed || ((OneAxisInputControl)instance2.inputHandler.inputActions.Up).IsPressed || ((OneAxisInputControl)instance2.inputHandler.inputActions.Left).IsPressed || ((OneAxisInputControl)instance2.inputHandler.inputActions.Right).IsPressed || !instance.CanSuperJump()) && instance.CanHarpoonDash()) { SetTriggerStateLeft(PlayerState.Hook); } } }
DuelsenseBridge.dll
Decompiled 2 days agousing System.Diagnostics; using System.Net; using System.Net.Sockets; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using DSX_UDP_Example; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("DuelsenseBridge")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DuelsenseBridge")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9116e3b0-4a1e-4e6a-bddc-b5ba8e8e05f4")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace DualSenseBridge; public static class Bridge { private static UdpClient client; private static IPEndPoint endpoint; private static int controllerIndex; public static void Init() { client = new UdpClient(); endpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 6969); } public static void RightTrigger(TriggerMode mode, int startPosition, int strength) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SendTrigger((Trigger)2, mode, startPosition, strength); } public static void LeftTrigger(TriggerMode mode, int startPosition, int strength) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SendTrigger((Trigger)1, mode, startPosition, strength); } public static void ResetLeftTrigger() { SendTrigger((Trigger)1, (TriggerMode)20, 0, 0); } public static void ResetRightTrigger() { SendTrigger((Trigger)2, (TriggerMode)20, 0, 0); } private static void SendTrigger(Trigger trigger, TriggerMode mode, int startPosition, int strength) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) Packet val = new Packet(); val.instructions = (Instruction[])(object)new Instruction[1] { new Instruction { type = (InstructionType)1, parameters = new object[5] { controllerIndex, trigger, mode, Clamp(startPosition, 1, 9), Clamp(strength, 0, 8) } } }; Packet packet = val; Send(packet); } public static void SendSlope(Trigger trigger, TriggerMode mode, int startPosition, int endPosition, int startResist, int endResist) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) Packet val = new Packet(); val.instructions = (Instruction[])(object)new Instruction[1] { new Instruction { type = (InstructionType)1, parameters = new object[7] { controllerIndex, trigger, mode, Clamp(startPosition, 1, 9), Clamp(endPosition, 2, 9), Clamp(startResist, 1, 8), Clamp(endResist, 1, 8) } } }; Packet packet = val; Send(packet); } public static void SendGallop(Trigger trigger, TriggerMode mode, int startPosition, int endPosition, int firstFoot, int secondFoot, int freq) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) Packet val = new Packet(); val.instructions = (Instruction[])(object)new Instruction[1] { new Instruction { type = (InstructionType)1, parameters = new object[8] { controllerIndex, trigger, mode, Clamp(startPosition, 1, 8), Clamp(endPosition, 2, 9), Clamp(firstFoot, 1, 6), Clamp(secondFoot, 2, 7), Clamp(freq, 1, 40) } } }; Packet packet = val; Send(packet); } public static void SendBow(Trigger trigger, TriggerMode mode, int startPosition, int endPosition, int resistStrength, int snapForce) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) Packet val = new Packet(); val.instructions = (Instruction[])(object)new Instruction[1] { new Instruction { type = (InstructionType)1, parameters = new object[7] { controllerIndex, trigger, mode, Clamp(startPosition, 1, 8), Clamp(endPosition, 2, 8), Clamp(resistStrength, 1, 8), Clamp(snapForce, 1, 8) } } }; Packet packet = val; Send(packet); } public static void SendVibration(Trigger trigger, TriggerMode mode, int startPosition, int amp, int freq) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) Packet val = new Packet(); val.instructions = (Instruction[])(object)new Instruction[1] { new Instruction { type = (InstructionType)1, parameters = new object[6] { controllerIndex, trigger, mode, Clamp(startPosition, 1, 9), Clamp(amp, 1, 8), Clamp(freq, 1, 40) } } }; Packet packet = val; Send(packet); } private static void Send(Packet packet) { if (client == null || endpoint == null) { return; } try { string s = Triggers.PacketToJson(packet); byte[] bytes = Encoding.UTF8.GetBytes(s); client.Send(bytes, bytes.Length, endpoint); } catch { } } private static int Clamp(int value, int min, int max) { if (value < min) { return min; } if (value > max) { return max; } return value; } }
Resources.dll
Decompiled 2 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Net; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using Newtonsoft.Json; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Resources")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Resources")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3924842-97aa-4bd6-ab6d-c312f8957396")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace DSX_UDP_Example; internal class Resources { } public static class Triggers { public static IPAddress localhost = new IPAddress(new byte[4] { 127, 0, 0, 1 }); public static string PacketToJson(Packet packet) { //IL_000c: Expected O, but got Unknown try { return JsonConvert.SerializeObject((object)packet); } catch (JsonException val) { JsonException val2 = val; Console.WriteLine("Serialization error: " + ((Exception)(object)val2).Message); return string.Empty; } } public static Packet JsonToPacket(string json) { return JsonConvert.DeserializeObject<Packet>(json); } } public struct Instruction { public InstructionType type; public object[] parameters; } public class Packet { public Instruction[] instructions; } public class ServerResponse { public string Status; public string TimeReceived; public bool isControllerConnected; public int BatteryLevel; public List<Device> Devices; } public class Device { public int Index; public string MacAddress; public DeviceType DeviceType; public ConnectionType ConnectionType; public int BatteryLevel; public bool IsSupportAT; public bool IsSupportLightBar; public bool IsSupportPlayerLED; public bool IsSupportMicLED; } public enum TriggerMode { Normal, GameCube, VerySoft, Soft, Hard, VeryHard, Hardest, Rigid, VibrateTrigger, Choppy, Medium, VibrateTriggerPulse, CustomTriggerValue, Resistance, Bow, Galloping, SemiAutomaticGun, AutomaticGun, Machine, VIBRATE_TRIGGER_10Hz, OFF, FEEDBACK, WEAPON, VIBRATION, SLOPE_FEEDBACK, MULTIPLE_POSITION_FEEDBACK, MULTIPLE_POSITION_VIBRATION } public enum CustomTriggerValueMode { OFF, Rigid, RigidA, RigidB, RigidAB, Pulse, PulseA, PulseB, PulseAB, VibrateResistance, VibrateResistanceA, VibrateResistanceB, VibrateResistanceAB, VibratePulse, VibratePulseA, VibratePulsB, VibratePulseAB } public enum PlayerLEDNewRevision { One, Two, Three, Four, Five, AllOff } public enum MicLEDMode { On, Pulse, Off } public enum Trigger { Invalid, Left, Right } public enum InstructionType { GetDSXStatus, TriggerUpdate, RGBUpdate, PlayerLED, TriggerThreshold, MicLED, PlayerLEDNewRevision, ResetToUserSettings } public enum ConnectionType { USB, BLUETOOTH, DONGLE } public enum DeviceType { DUALSENSE, DUALSENSE_EDGE, DUALSHOCK_V1, DUALSHOCK_V2, DUALSHOCK_DONGLE, PS_VR2_LeftController, PS_VR2_RightController, ACCESS_CONTROLLER }