Decompiled source of The Lag Fixer v2.0.0
TheLagFixer/goi.barackobusiness.lagfixer.BepInEx5.dll
Decompiled a day agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("goi.barackobusiness.lagfixer")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0+074f1c29b4f349491c6b4f4402fcc95c8ec4467d")] [assembly: AssemblyProduct("The Lag Fixer")] [assembly: AssemblyTitle("goi.barackobusiness.lagfixer")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TheLagFixer { internal static class Hooks { [CompilerGenerated] private static class <>O { public static Manipulator <0>__FixedUpdate; } private const BindingFlags Public = BindingFlags.Public; private const BindingFlags Instance = BindingFlags.Instance; private static ManualLogSource _logger; private static ILHook _hook; internal static void Hook(ManualLogSource logger) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown _logger = logger; _logger.LogInfo((object)"Hooking CameraControl::FixedUpdate"); MethodInfo method = GetMethod<CameraControl>("FixedUpdate", BindingFlags.Instance | BindingFlags.Public); object obj = <>O.<0>__FixedUpdate; if (obj == null) { Manipulator val = FixedUpdate; <>O.<0>__FixedUpdate = val; obj = (object)val; } _hook = new ILHook((MethodBase)method, (Manipulator)obj); } internal static void Unhook() { ILHook hook = _hook; if (hook != null) { hook.Dispose(); } } private static void FixedUpdate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: 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) ILCursor val = new ILCursor(il).Goto(0, (MoveType)0, false); if (val.TryGotoNext(new Func<Instruction, bool>[11] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCall<Component>(x, "get_transform"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCall<Component>(x, "get_transform"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Transform>(x, "get_position"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CameraControl>(x, "vel"), (Instruction x) => ILPatternMatchingExt.MatchCall<Time>(x, "get_fixedDeltaTime"), (Instruction x) => ILPatternMatchingExt.MatchCall<Vector3>(x, "op_Multiply"), (Instruction x) => ILPatternMatchingExt.MatchCall<Vector3>(x, "op_Addition"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Transform>(x, "set_position") })) { _logger.LogInfo((object)"CameraControl::FixedUpdate hooked"); val.GotoNext(Array.Empty<Func<Instruction, bool>>()); val.RemoveRange(10); val.Emit(OpCodes.Ldarg_0); val.Emit<CameraControl>(OpCodes.Ldfld, "vel"); val.EmitDelegate<Action<CameraControl, Vector3>>((Action<CameraControl, Vector3>)delegate(CameraControl self, Vector3 vel) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) Rigidbody component = ((Component)self).GetComponent<Rigidbody>(); component.MovePosition(component.position + vel * Time.fixedDeltaTime); }); } } private static MethodInfo GetMethod<T>(string name, BindingFlags flags) { return typeof(T).GetMethod(name, flags); } } [BepInPlugin("goi.barackobusiness.lagfixer", "The Lag Fixer", "2.0.0")] public class LagFixerPlugin : BaseUnityPlugin { private void Awake() { SceneManager.sceneLoaded += OnSceneLoad; Hooks.Hook(((BaseUnityPlugin)this).Logger); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin goi.barackobusiness.lagfixer is loaded!"); } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoad; Hooks.Unhook(); } private void OnSceneLoad(Scene scene, LoadSceneMode mode) { if (!(((Scene)(ref scene)).name != "Mian")) { Rigidbody obj = ((Component)Camera.main).gameObject.AddComponent<Rigidbody>(); obj.interpolation = (RigidbodyInterpolation)1; obj.isKinematic = true; Rigidbody2D[] array = Resources.FindObjectsOfTypeAll<Rigidbody2D>(); for (int i = 0; i < array.Length; i++) { array[i].interpolation = (RigidbodyInterpolation2D)1; } } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "goi.barackobusiness.lagfixer"; public const string PLUGIN_NAME = "The Lag Fixer"; public const string PLUGIN_VERSION = "2.0.0"; } }
TheLagFixer/goi.barackobusiness.lagfixer.dll
Decompiled a day agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("goi.barackobusiness.lagfixer")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0+b8f705bdc17cbdb8482d5a9632598ae8edcddfb4")] [assembly: AssemblyProduct("The Lag Fixer")] [assembly: AssemblyTitle("goi.barackobusiness.lagfixer")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TheLagFixer { internal static class Hooks { [CompilerGenerated] private static class <>O { public static Manipulator <0>__FixedUpdate; } private const BindingFlags Public = BindingFlags.Public; private const BindingFlags Instance = BindingFlags.Instance; private static ManualLogSource _logger; private static ILHook _hook; internal static void Hook(ManualLogSource logger) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown _logger = logger; _logger.LogInfo((object)"Hooking CameraControl::FixedUpdate"); MethodInfo method = GetMethod<CameraControl>("FixedUpdate", BindingFlags.Instance | BindingFlags.Public); object obj = <>O.<0>__FixedUpdate; if (obj == null) { Manipulator val = FixedUpdate; <>O.<0>__FixedUpdate = val; obj = (object)val; } _hook = new ILHook((MethodBase)method, (Manipulator)obj); } internal static void Unhook() { ILHook hook = _hook; if (hook != null) { hook.Dispose(); } } private static void FixedUpdate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: 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) ILCursor val = new ILCursor(il).Goto(0, (MoveType)0, false); if (val.TryGotoNext(new Func<Instruction, bool>[11] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCall<Component>(x, "get_transform"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCall<Component>(x, "get_transform"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Transform>(x, "get_position"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CameraControl>(x, "vel"), (Instruction x) => ILPatternMatchingExt.MatchCall<Time>(x, "get_fixedDeltaTime"), (Instruction x) => ILPatternMatchingExt.MatchCall<Vector3>(x, "op_Multiply"), (Instruction x) => ILPatternMatchingExt.MatchCall<Vector3>(x, "op_Addition"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Transform>(x, "set_position") })) { _logger.LogInfo((object)"CameraControl::FixedUpdate hooked"); val.GotoNext(Array.Empty<Func<Instruction, bool>>()); val.RemoveRange(10); val.Emit(OpCodes.Ldarg_0); val.Emit<CameraControl>(OpCodes.Ldfld, "vel"); val.EmitDelegate<Action<CameraControl, Vector3>>((Action<CameraControl, Vector3>)delegate(CameraControl self, Vector3 vel) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) Rigidbody component = ((Component)self).GetComponent<Rigidbody>(); component.MovePosition(component.position + vel * Time.fixedDeltaTime); }); } } private static MethodInfo GetMethod<T>(string name, BindingFlags flags) { return typeof(T).GetMethod(name, flags); } } [BepInPlugin("goi.barackobusiness.lagfixer", "The Lag Fixer", "2.0.0")] public class LagFixerPlugin : BaseUnityPlugin { private void Awake() { SceneManager.sceneLoaded += OnSceneLoad; Hooks.Hook(((BaseUnityPlugin)this).Logger); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin goi.barackobusiness.lagfixer is loaded!"); } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoad; Hooks.Unhook(); } private void OnSceneLoad(Scene scene, LoadSceneMode mode) { if (!(((Scene)(ref scene)).name != "Mian")) { Rigidbody obj = ((Component)Camera.main).gameObject.AddComponent<Rigidbody>(); obj.interpolation = (RigidbodyInterpolation)1; obj.isKinematic = true; Rigidbody2D[] array = Resources.FindObjectsOfTypeAll<Rigidbody2D>(); for (int i = 0; i < array.Length; i++) { array[i].interpolation = (RigidbodyInterpolation2D)1; } } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "goi.barackobusiness.lagfixer"; public const string PLUGIN_NAME = "The Lag Fixer"; public const string PLUGIN_VERSION = "2.0.0"; } }