using System;
using System.Diagnostics;
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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("_NoUselessWarnings")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("JustAFrogger")]
[assembly: AssemblyProduct("_NoUselessWarnings")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("46BDCABE-BEB1-491F-8631-310F5186A3DB")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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 _NoUselessWarnings
{
[HarmonyPatch]
public class NoWarnings
{
[HarmonyPatch(typeof(ConsoleLogListener), "LogEvent")]
[HarmonyPrefix]
private static bool ConsoleLogListenerLog(object sender, LogEventArgs eventArgs)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Invalid comparison between Unknown and I4
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Invalid comparison between Unknown and I4
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Invalid comparison between Unknown and I4
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Invalid comparison between Unknown and I4
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Invalid comparison between Unknown and I4
if ((int)eventArgs.Level == 1 || (int)eventArgs.Level == 2)
{
return true;
}
string text = eventArgs.Data.ToString();
if (Plugin.shaders.Value && text.Contains("Failed to find expected binary shader data"))
{
return false;
}
if (Plugin.platformPrefs.Value && (text.Contains("Fetching PlatformPrefs 'GuiScale' before loading defaults") || text.Contains("Using default prefs")))
{
return false;
}
if (Plugin.missingAudioClip.Value && text.Contains("Missing audio clip in music respawn"))
{
return false;
}
if (Plugin.onlyCustomFiltersCanBePlayed.Value && text.Contains("Only custom filters can be played. Please add a custom filter or an audioclip to the audiosource"))
{
return false;
}
if (Plugin.camZoom.Value && text.Contains("CamZoom"))
{
return false;
}
if (Plugin.localizationLoaded.Value && text.Contains("Loaded localization file"))
{
return false;
}
if (Plugin.jotunnInitialization.Value && text.Contains("Initializing") && eventArgs.Source.SourceName == "Jotunn.Main" && ((int)eventArgs.Level == 32 || (int)eventArgs.Level == 16))
{
return false;
}
if (Plugin.jotunnLogs.Value && (text.Contains("Adding ") || text.Contains("Injecting ")) && eventArgs.Source.SourceName.StartsWith("Jotunn.") && ((int)eventArgs.Level == 32 || (int)eventArgs.Level == 16))
{
return false;
}
if (Plugin.addedLocationsAndVegetation.Value && text.Contains("Added ") && text.Contains(" locations and ") && text.Contains(" vegetation"))
{
return false;
}
if (Plugin.worldLoading.Value && (text.Contains("ZNET START") || text.Contains(" Creating ZDOs") || text.Contains(" Loading in ZDOs") || text.Contains(" Adding to Dictionary") || text.Contains(" Adding to Sectors") || text.Contains(" Connecting Portals, Spawners & ZSyncTransforms") || text.Contains(" Session auth respons callback") || text.Contains(" Unpacking compressed mapdata") || text.Contains(" Update PlayFab entity token") || text.Contains(" Starting respawn") || text.Contains(" tip:$loadscreen_tip") || text.Contains("Skipping unloading unused assets")))
{
return false;
}
if (Plugin.createdConfigSync.Value && (text.Contains(" ConfigSync' RPC - waiting for incoming connections") || (text.Contains("Registering ") && text.Contains(" custom RPCs"))))
{
return false;
}
if (Plugin.recipeUnlock.Value && text.Contains(" Queue unlock msg:"))
{
return false;
}
if (Plugin.valheimMenuInitialization.Value && (text.Contains(" Using environment steamid") || text.Contains(" Using steam APPID:892970") || text.Contains(" Caching Steam ID: 76561199176697070 [API loaded no]") || text.Contains(" Steam initialized, persona:") || text.Contains("Authentication:k_ESteamNetworkingAvailability_Attempting") || text.Contains("PlayFab custom ID set to ") || text.Contains("Worldgenerator version setup:2") || text.Contains("Render threading mode:MultiThreaded") || text.Contains("Checking for installed DLCs") || text.Contains("Sending PlayFab login request") || text.Contains("Ticket is System.Byte[] of length ") || text.Contains("Starting music menu") || text.Contains("PlayFab logged in as ") || text.Contains("PlayFab local entity ID is ") || text.Contains("Zonesystem Awake") || text.Contains("DungeonDB Awake") || text.Contains("Worldgenerator version setup:2")))
{
return false;
}
return true;
}
}
[BepInPlugin("com.Frogger.NoUselessWarnings", "Frogger.NoUselessWarnings", "1.1.0")]
[HarmonyPriority(999999)]
internal class Plugin : BaseUnityPlugin
{
internal const string ModName = "Frogger.NoUselessWarnings";
internal const string ModVersion = "1.1.0";
internal const string ModGUID = "com.Frogger.NoUselessWarnings";
internal static ManualLogSource log;
public static ConfigEntry<bool> shaders;
public static ConfigEntry<bool> platformPrefs;
public static ConfigEntry<bool> camZoom;
public static ConfigEntry<bool> jotunnInitialization;
public static ConfigEntry<bool> jotunnLogs;
public static ConfigEntry<bool> localizationLoaded;
public static ConfigEntry<bool> missingAudioClip;
public static ConfigEntry<bool> onlyCustomFiltersCanBePlayed;
public static ConfigEntry<bool> addedLocationsAndVegetation;
public static ConfigEntry<bool> worldLoading;
public static ConfigEntry<bool> createdConfigSync;
public static ConfigEntry<bool> recipeUnlock;
public static ConfigEntry<bool> valheimMenuInitialization;
private void Awake()
{
log = ((BaseUnityPlugin)this).Logger;
shaders = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Shaders", true, "");
platformPrefs = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "PlatformPrefs", true, "");
camZoom = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "CamZoom", true, "");
jotunnInitialization = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Jotunn initialization", true, "");
jotunnLogs = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Jotunn logs", true, "");
localizationLoaded = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Localization loaded", true, "");
missingAudioClip = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Missing audio clip", true, "");
onlyCustomFiltersCanBePlayed = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Only custom filters can be played", true, "");
addedLocationsAndVegetation = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Added locations and vegetation", true, "");
worldLoading = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "World loading", true, "");
createdConfigSync = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Created ConfigSync", true, "");
recipeUnlock = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Recipe unlock", true, "");
valheimMenuInitialization = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Valheim menu initialization", true, "");
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.Frogger.NoUselessWarnings");
}
}
}