Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LogMuteLethal v1.0.1
LogMuteLethal.dll
Decompiled a year agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HDeMods.MUTE; using HarmonyLib; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LogMuteLethal")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+614e03eb10519eee960e42126a28db5ce923f2bc")] [assembly: AssemblyProduct("LogMuteLethal")] [assembly: AssemblyTitle("LogMuteLethal")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] 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 NativeIntegerAttribute : Attribute { public readonly bool[] TransformFlags; public NativeIntegerAttribute() { TransformFlags = new bool[1] { true }; } public NativeIntegerAttribute(bool[] P_0) { TransformFlags = P_0; } } } namespace HDeMods { internal static class LogMuteLethal { private static bool RemoveLogFormat(this ILCursor c, string logName) { return c.RemoveLog(logName, 2); } private static bool RemoveLog(this ILCursor c, string logName, int count = 1) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (!c.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Debug>(x, logName) })) { Log.Error("Failed to silence " + ((MemberReference)c.Method).Name); return false; } for (int i = 0; i < count; i++) { c.Emit(OpCodes.Pop); } c.Remove(); Log.Info("Silenced " + ((MemberReference)c.Method).Name); return true; } private static bool RemoveMultipleLogs(this ILCursor c, string logName, int count) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < count; i++) { if (!c.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Debug>(x, logName) })) { Log.Error("Failed to silence " + ((MemberReference)c.Method).Name); return false; } c.Emit(OpCodes.Pop); c.Remove(); } Log.Info("Silenced " + ((MemberReference)c.Method).Name); return true; } internal static void Startup() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) new ILHook((MethodBase)AccessTools.Method(typeof(HoarderBugAI), "SetGoTowardsTargetObject", (Type[])null, (Type[])null), new Manipulator(HoarderBugAI_SetGoTowardsTargetObject)); new ILHook((MethodBase)AccessTools.Method(typeof(DepositItemsDesk), "Update", (Type[])null, (Type[])null), new Manipulator(DepositItemsDesk_Update)); new ILHook((MethodBase)AccessTools.EnumeratorMoveNext((MethodBase)AccessTools.Method(typeof(HUDManager), "SetPlayerLevelSmoothly", (Type[])null, (Type[])null)), new Manipulator(HUDManager_SetPlayerLevelSmoothly)); new ILHook((MethodBase)AccessTools.Method(typeof(NetworkVariableBase), "SetDirty", (Type[])null, (Type[])null), new Manipulator(NetworkVariableBase_SetDirty)); new ILHook((MethodBase)AccessTools.Method(typeof(AudioSource), "PlayOneShot", new Type[2] { typeof(AudioClip), typeof(float) }, (Type[])null), new Manipulator(AudioSource_PlayOneShot)); LogMuteUnity.Startup(); LogMuteReveal.Startup(); } private static void HUDManager_SetPlayerLevelSmoothly(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RemoveLog(new ILCursor(il), "Log"); } private static void HoarderBugAI_SetGoTowardsTargetObject(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RemoveMultipleLogs(new ILCursor(il), "Log", 2); } private static void DepositItemsDesk_Update(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RemoveMultipleLogs(new ILCursor(il), "Log", 2); } private static void NetworkVariableBase_SetDirty(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RemoveLog(new ILCursor(il), "LogWarning"); } private static void AudioSource_PlayOneShot(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RemoveLog(new ILCursor(il), "LogWarning"); } } internal static class LogMuteReveal { public static void Startup() { } } internal static class LogMuteUnity { [DllImport("kernel32", ExactSpelling = true)] private unsafe static extern int FlushInstructionCache(nint handle, void* baseAddr, nuint size); [DllImport("kernel32.dll")] private static extern bool VirtualProtectEx(IntPtr hProcess, IntPtr lpAddress, UIntPtr dwSize, uint flNewProtect, out uint lpflOldProtect); public static void Startup() { Process currentProcess = Process.GetCurrentProcess(); IntPtr baseAddress = currentProcess.Modules.Cast<ProcessModule>().Single((ProcessModule m) => m.ModuleName == "UnityPlayer.dll").BaseAddress; if (!NopLocation(currentProcess, baseAddress, 12188160, 11280188857790794728uL)) { Log.Error("Failed to silence Audio Source!"); } if (!NopLocation(currentProcess, baseAddress, 983177, 13558103175015826152uL)) { Log.Error("Failed to silence Look Zero!"); } if (!NopLocation(currentProcess, baseAddress, 12190251, 9023032223454486760uL)) { Log.Error("Failed to silence Custom Filter!"); } if (!NopLocation(currentProcess, baseAddress, 10703121, 1782721766651165416uL)) { Log.Error("Failed to silence NavMesh!"); } if (!NopLocation(currentProcess, baseAddress, 10723257, 5242244943489716968uL)) { Log.Error("Failed to silence SetDestination!"); } } private unsafe static bool NopLocation(Process currentProc, IntPtr baseAddress, nint offset, ulong instrToReplace) { ulong num = 18446742974197923840uL; byte* ptr = (byte*)((nint)baseAddress + offset); if (*(long*)ptr != (long)instrToReplace) { string text = ((long*)ptr)->ToString("X"); long num2 = (long)instrToReplace; Log.Error("No Match. " + text + " " + num2.ToString("X")); return false; } num &= instrToReplace; num |= 0x9048904866uL; VirtualProtectEx(currentProc.Handle, (IntPtr)ptr, (UIntPtr)8uL, 64u, out var lpflOldProtect); *(ulong*)ptr = num; VirtualProtectEx(currentProc.Handle, (IntPtr)ptr, (UIntPtr)8uL, lpflOldProtect, out var _); if (FlushInstructionCache(currentProc.Handle, ptr, 8u) == 0) { return false; } return true; } } [BepInPlugin("com.HDeDeDe.LogMuteLethal", "LogMuteLethal", "1.0.1")] public sealed class LogMuteLethalPlugin : BaseUnityPlugin { public const string PluginGUID = "com.HDeDeDe.LogMuteLethal"; public const string PluginAuthor = "HDeDeDe"; public const string PluginName = "LogMuteLethal"; public const string PluginVersion = "1.0.1"; public static LogMuteLethalPlugin instance; private void Awake() { if ((Object)(object)instance != (Object)null) { Log.Error("There can be only 1 instance of LogMuteLethal!"); Object.Destroy((Object)(object)this); } else { Log.Init(((BaseUnityPlugin)this).Logger); instance = this; LogMuteLethal.Startup(); } } } public static class PluginInfo { public const string PLUGIN_GUID = "LogMuteLethal"; public const string PLUGIN_NAME = "LogMuteLethal"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace HDeMods.MUTE { internal static class Log { private static ManualLogSource logMe; internal static void Init(ManualLogSource logSource) { logMe = logSource; } internal static void Debug(object data) { logMe.LogDebug(data); } internal static void Error(object data) { logMe.LogError(data); } internal static void Fatal(object data) { logMe.LogFatal(data); } internal static void Info(object data) { logMe.LogInfo(data); } internal static void Message(object data) { logMe.LogMessage(data); } internal static void Warning(object data) { logMe.LogWarning(data); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }