The BepInEx console will not appear when launching like it does for other games on Thunderstore (you can turn it back on in your BepInEx.cfg file). If your PEAK crashes on startup, add -dx12 to your launch parameters.
Decompiled source of CustomBugle v1.3.1
CustomBugle.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("SlimeYuri_CustomBugle")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SlimeYuri_CustomBugle")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4409cff3-398c-4a65-ba84-16595b826019")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace SlimeYuri_CustomBugle; [BepInPlugin("CustomBugle_SlimeYuri", "CustomBugle", "1.3.0")] [BepInProcess("PEAK.exe")] public class Peak_Project : BaseUnityPlugin { internal static float globalVolume = 0.35f; private const float VOLUME_STEP = 0.5f; private const float CLAMP_MIN = 0f; private const float CLAMP_MAX = 1f; private ConfigEntry<KeyCode> hotkey; private Rect windowRect = new Rect((float)(Screen.width - 110), 10f, 100f, 60f); private static bool openRandomPitch = true; private bool open = false; private static Dictionary<int, AudioClip> customBugleClips = new Dictionary<int, AudioClip>(); private static float Counter = 0f; private static int RefactorIndex = 10; private static int MusicNum = 0; private void Awake() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"[CustomBugle] 启动中"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"BepInEx:HelloWorld"); Harmony val = new Harmony("CustomBugle_SlimeYuri"); Type type = AccessTools.TypeByName("BugleSFX"); if (type == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[CustomBugle] 没有找到音频文件SFX!"); return; } MethodInfo method = type.GetMethod("Update", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo methodInfo = AccessTools.Method(typeof(Peak_Project), "UpdatePostfix", (Type[])null, (Type[])null); if (method == null || methodInfo == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[CustomBugle] 没有找到补丁运行方法"); return; } val.Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(methodInfo), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.PatchAll(typeof(Peak_Project)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[CustomBugle] Harmony patch 成功运行"); LoadCustomClips(); } private void LoadCustomClips() { string path = Path.Combine(Paths.PluginPath, "Slime_Silly-CustomBugle"); string[] files = Directory.GetFiles(path); int num = 0; string[] array = files; foreach (string text in array) { string text2 = Path.GetExtension(text).ToLower(); if (text2 == ".wav" || text2 == ".mp3" || text2 == ".ogg") { ((MonoBehaviour)this).StartCoroutine(LoadAudioClip(num, text)); num++; } } } private IEnumerator LoadAudioClip(int index, string filePath) { string uri = "file://" + filePath; string extension = Path.GetExtension(filePath).ToLower(); AudioType audioType; switch (extension) { case ".mp3": audioType = (AudioType)13; break; case ".wav": audioType = (AudioType)20; break; case ".ogg": audioType = (AudioType)14; break; default: ((BaseUnityPlugin)this).Logger.LogWarning((object)("[CustomBugle] 不支持的文件格式: " + extension)); yield break; } UnityWebRequest uwr = UnityWebRequestMultimedia.GetAudioClip(uri, audioType); try { yield return uwr.SendWebRequest(); if ((int)uwr.result == 2 || (int)uwr.result == 3) { ((BaseUnityPlugin)this).Logger.LogError((object)("[CustomBugle] 加载失败: " + filePath + ", Error: " + uwr.error)); yield break; } AudioClip clip = DownloadHandlerAudioClip.GetContent(uwr); if ((Object)(object)clip != (Object)null) { customBugleClips[index] = clip; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[CustomBugle] 成功加载: " + filePath)); MusicNum = customBugleClips.Keys.Count((int key) => key >= 0); Debug.LogError((object)$"有 {MusicNum}首歌曲"); RefactorIndex = customBugleClips.Keys.Count((int key) => key >= 0); Debug.LogError((object)$" 重构因子{RefactorIndex}"); } else { ((BaseUnityPlugin)this).Logger.LogError((object)("[CustomBugle] 音频解码失败: " + filePath)); } } finally { ((IDisposable)uwr)?.Dispose(); } } [HarmonyPrefix] [HarmonyPatch(typeof(BugleSFX), "Update")] private static void UpdatePrefix(BugleSFX __instance) { float axis = Input.GetAxis("Mouse ScrollWheel"); if (Mathf.Abs(axis) > float.Epsilon) { globalVolume += axis * 0.5f; globalVolume = Mathf.Clamp(globalVolume, 0f, 1f); Debug.Log((object)$"[CustomBugle] 滚轮调整音量至: {globalVolume:F2}"); } __instance.volume = globalVolume; } private static void UpdatePostfix(object __instance) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown Counter += Time.deltaTime; Type type = __instance.GetType(); FieldInfo fieldInfo = AccessTools.Field(type, "hold"); FieldInfo fieldInfo2 = AccessTools.Field(type, "bugle"); FieldInfo fieldInfo3 = AccessTools.Field(type, "buglePlayer"); FieldInfo fieldInfo4 = AccessTools.Field(type, "currentClip"); if (fieldInfo == null || fieldInfo2 == null || fieldInfo3 == null || fieldInfo4 == null) { return; } bool flag = (bool)fieldInfo.GetValue(__instance); AudioSource val = (AudioSource)fieldInfo3.GetValue(__instance); int key2 = (int)fieldInfo4.GetValue(__instance); if (!flag || !((Object)(object)val != (Object)null) || !customBugleClips.TryGetValue(key2, out var value) || !((Object)(object)val.clip != (Object)(object)value)) { return; } val.clip = value; if (!openRandomPitch) { val.pitch = 1f; } val.Play(); if (!(Counter > 0.2f) || MusicNum <= 4) { return; } Counter = 0f; List<KeyValuePair<int, AudioClip>> list = customBugleClips.OrderBy((KeyValuePair<int, AudioClip> pair) => pair.Key).ToList(); Dictionary<int, AudioClip> dictionary = new Dictionary<int, AudioClip>(); int num = Random.Range(RefactorIndex - MusicNum, RefactorIndex - 4 + 1); foreach (KeyValuePair<int, AudioClip> item in list) { int key3 = item.Key - num; dictionary[key3] = item.Value; } customBugleClips = dictionary; RefactorIndex = customBugleClips.Keys.Count((int key) => key >= 0); foreach (int key4 in customBugleClips.Keys) { Debug.LogError((object)"以下是重构~"); Debug.LogError((object)key4); Debug.LogError((object)customBugleClips[key4]); } Debug.LogError((object)$" 重构因子{RefactorIndex}"); } private void Start() { hotkey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("快捷键", "hotkey", (KeyCode)99, "默认键位键盘C,改键位时复制上述支持的键位即可:The default key for the keyboard is C. When changing the key, you can copy the supported keys mentioned above."); } private void Update() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(hotkey.Value)) { open = !open; } } private void OnGUI() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (open) { windowRect = GUILayout.Window(0, windowRect, new WindowFunction(WindowFun), "Manager", Array.Empty<GUILayoutOption>()); } } public void WindowFun(int id) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.FlexibleSpace(); if (GUILayout.Button("X", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(22f) })) { open = false; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(GUI.skin.box, Array.Empty<GUILayoutOption>()); GUILayout.Label("音量:Volume", Array.Empty<GUILayoutOption>()); GUILayout.Label((int)(globalVolume * 100f) + "%", Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); GUILayout.HorizontalSlider(globalVolume, 0f, 1f, Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(GUI.skin.box, Array.Empty<GUILayoutOption>()); openRandomPitch = GUILayout.Toggle(openRandomPitch, "点击我关闭随机音调:click me to diactive random Pitch", Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(GUI.skin.box, Array.Empty<GUILayoutOption>()); GUILayout.Label("ScrollUp向上滚轮__Volume++", Array.Empty<GUILayoutOption>()); GUILayout.Label("ScrollDown向下滚轮__Volume--", Array.Empty<GUILayoutOption>()); GUILayout.Label("进入ESC菜单来点选按钮", Array.Empty<GUILayoutOption>()); GUILayout.Label("Enter the ESC menu and select the button.", Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); GUI.DragWindow(); } }