Decompiled source of Advanced Audio Settings v1.0.1

AdvancedAudioSettings.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AdvancedAudioSettings;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
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: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("AdvancedAudioSettings")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Advanced Audio Settings")]
[assembly: AssemblyTitle("AdvancedAudioSettings")]
[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 NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
[HarmonyPatch(typeof(CriSoundManager), "CreateSoundSource")]
public static class CreateSoundSource
{
	public static void Prefix(ref float volume, MixingCategory category)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Invalid comparison between Unknown and I4
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Invalid comparison between Unknown and I4
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Invalid comparison between Unknown and I4
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Invalid comparison between Unknown and I4
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Invalid comparison between Unknown and I4
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Invalid comparison between Unknown and I4
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Invalid comparison between Unknown and I4
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Invalid comparison between Unknown and I4
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Invalid comparison between Unknown and I4
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Invalid comparison between Unknown and I4
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Invalid comparison between Unknown and I4
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Invalid comparison between Unknown and I4
		if ((int)category == 3 || (int)category == 3)
		{
			volume *= Plugin.c_BGBase.Value;
		}
		if ((int)category == 4)
		{
			volume *= Plugin.c_BG.Value;
		}
		if ((int)category == 6)
		{
			volume *= Plugin.c_BGRes.Value;
		}
		if ((int)category == 9)
		{
			volume *= Plugin.c_MI.Value;
		}
		if ((int)category == 11)
		{
			volume *= Plugin.c_baseMusic.Value;
		}
		if ((int)category == 12)
		{
			volume *= Plugin.c_menuMusic.Value;
		}
		if ((int)category == 13)
		{
			volume *= Plugin.c_titleMusic.Value;
		}
		if ((int)category == 2)
		{
			volume *= Plugin.c_sfx.Value;
		}
		if ((int)category == 8)
		{
			volume *= Plugin.c_resultMusic.Value;
		}
		if ((int)category == 7)
		{
			volume *= Plugin.c_minigameMusic.Value;
		}
		if ((int)category == 5)
		{
			volume *= Plugin.c_drumSounds.Value;
		}
	}
}
namespace AdvancedAudioSettings
{
	[BepInPlugin("com.nextrg.advancedaudiosettings", "Advanced Audio Settings", "1.0.0")]
	public class Plugin : BasePlugin
	{
		public static ConfigEntry<float> c_BGBase;

		public static ConfigEntry<float> c_BG;

		public static ConfigEntry<float> c_BGRes;

		public static ConfigEntry<float> c_MI;

		public static ConfigEntry<float> c_baseMusic;

		public static ConfigEntry<float> c_menuMusic;

		public static ConfigEntry<float> c_titleMusic;

		public static ConfigEntry<float> c_sfx;

		public static ConfigEntry<float> c_resultMusic;

		public static ConfigEntry<float> c_minigameMusic;

		public static ConfigEntry<float> c_drumSounds;

		internal static ManualLogSource Log;

		public static ConfigFile config;

		private FileSystemWatcher _watcher;

		private const string guid = "com.nextrg.advancedaudiosettings";

		public override void Load()
		{
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Expected O, but got Unknown
			Log = ((BasePlugin)this).Log;
			config = ((BasePlugin)this).Config;
			Log.LogInfo((object)"Loaded");
			c_BGBase = ((BasePlugin)this).Config.Bind<float>("Bgm", "Background", 1f, (ConfigDescription)null);
			c_BG = ((BasePlugin)this).Config.Bind<float>("Bgm", "Progress", 1f, (ConfigDescription)null);
			c_BGRes = ((BasePlugin)this).Config.Bind<float>("Bgm", "UnitResponse", 1f, (ConfigDescription)null);
			c_baseMusic = ((BasePlugin)this).Config.Bind<float>("Music", "Base", 1f, (ConfigDescription)null);
			c_menuMusic = ((BasePlugin)this).Config.Bind<float>("Music", "Maps", 1f, (ConfigDescription)null);
			c_titleMusic = ((BasePlugin)this).Config.Bind<float>("Music", "TitleScreen", 1f, (ConfigDescription)null);
			c_resultMusic = ((BasePlugin)this).Config.Bind<float>("Music", "Results", 1f, (ConfigDescription)null);
			c_minigameMusic = ((BasePlugin)this).Config.Bind<float>("Music", "Minigames", 1f, (ConfigDescription)null);
			c_sfx = ((BasePlugin)this).Config.Bind<float>("Other", "SFX", 1f, (ConfigDescription)null);
			c_MI = ((BasePlugin)this).Config.Bind<float>("Other", "Miracle", 1f, (ConfigDescription)null);
			c_drumSounds = ((BasePlugin)this).Config.Bind<float>("Other", "Drum", 1f, (ConfigDescription)null);
			CheckConfigChanges();
			Harmony val = new Harmony("com.nextrg.advancedaudiosettings");
			val.PatchAll();
		}

		public void CheckConfigChanges()
		{
			_watcher = new FileSystemWatcher(Path.GetDirectoryName(config.ConfigFilePath))
			{
				Filter = Path.GetFileName(config.ConfigFilePath),
				NotifyFilter = (NotifyFilters.Size | NotifyFilters.LastWrite),
				IncludeSubdirectories = false
			};
			_watcher.Changed += delegate
			{
				try
				{
					config.Reload();
				}
				catch (Exception)
				{
				}
			};
			_watcher.EnableRaisingEvents = true;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "AdvancedAudioSettings";

		public const string PLUGIN_NAME = "Advanced Audio Settings";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}