using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ModMuffler")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Kilika")]
[assembly: AssemblyProduct("ModMuffler")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("74aab110-bc4a-431c-bb04-2192352b02b7")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MenuMuffler
{
public static class Constants
{
public static class Config
{
public const string SectionName = "Main Menu Muffler";
public const string MuffleBackground = "Activate Menu Muffler";
public const string MuffleBackgroundDescription = "Enable or disable the menu background muffler. This will mute the background music in the main menu.";
}
public const string PluginGuid = "AD93CBED-58A7-450B-A27A-67DE3C449A49";
public const string PluginName = "Main Menu Muffler";
public const string HarmonyId = "de.kilika.distance.MainMenuMuffler";
}
[BepInPlugin("AD93CBED-58A7-450B-A27A-67DE3C449A49", "Main Menu Muffler", "1.0.0")]
public sealed class Mod : BaseUnityPlugin
{
internal static ManualLogSource Logger { get; private set; }
internal static ConfigEntry<bool> MuteMenuBackground { get; set; }
private void Awake()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
Logger = Logger.CreateLogSource("Main Menu Muffler");
MuteMenuBackground = ((BaseUnityPlugin)this).Config.Bind<bool>("Main Menu Muffler", "Activate Menu Muffler", true, "Enable or disable the menu background muffler. This will mute the background music in the main menu.");
MuteMenuBackground.SettingChanged += delegate
{
TriggerAudioPrompt();
};
Harmony val = new Harmony("de.kilika.distance.MainMenuMuffler");
Logger.LogInfo((object)"Loading...");
val.PatchAll();
Logger.LogInfo((object)"Loaded!");
}
private void TriggerAudioPrompt()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
G.Sys.AudioManager_.PromptMusicCue(G.Sys.GameManager_.Level_.Settings_.musicCueID_, false, true);
}
}
}
namespace MenuMuffler.Patches
{
[HarmonyPatch(typeof(AudioManager), "PromptMusicCue")]
internal class AudioManager_PromptMusicCuePatch
{
[HarmonyPrefix]
public static void MenuMufflerPatch(ref MusicCueID cueID, bool restart, bool stopPrevious)
{
if (Mod.MuteMenuBackground.Value && GameManager.IsInMainMenuScene_)
{
Mod.Logger.LogInfo((object)$"Replace: {cueID} with {(object)(MusicCueID)0}");
cueID = (MusicCueID)0;
}
}
}
}