using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; 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("BoomBoxMoreCustomMusic")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BoomBoxMoreCustomMusic")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("874615ec-0ae6-41d0-9134-16ebf5d9cd01")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("com.bublensky.BoomBoxMoreCustom", "BoomBox Custom More Music", "1.2.0")] public class BoomBoxMoreCustomMusic : BaseUnityPlugin { [CompilerGenerated] private sealed class d__11 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public BoomBoxMoreCustomMusic <>4__this; private List 5__1; private string[] <>s__2; private int <>s__3; private string 5__4; private string[] 5__5; private Exception 5__6; private List.Enumerator <>s__7; private string 5__8; private AudioType 5__9; private string 5__10; private string 5__11; private UnityWebRequest 5__12; private AudioClip 5__13; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if ((uint)(num - -4) <= 1u || num == 1) { try { if (num == -4 || num == 1) { try { } finally { <>m__Finally2(); } } } finally { <>m__Finally1(); } } 5__1 = null; <>s__2 = null; 5__4 = null; 5__5 = null; 5__6 = null; <>s__7 = default(List.Enumerator); 5__8 = null; 5__10 = null; 5__11 = null; 5__12 = null; 5__13 = null; <>1__state = -2; } private bool MoveNext() { //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Invalid comparison between Unknown and I4 //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)("[BoomboxCustomMusic] Scanning for music in: " + modPath)); if (!Directory.Exists(modPath)) { return false; } 5__1 = new List(); <>s__2 = audioExtensions; for (<>s__3 = 0; <>s__3 < <>s__2.Length; <>s__3++) { 5__4 = <>s__2[<>s__3]; try { 5__5 = Directory.GetFiles(modPath, 5__4, SearchOption.AllDirectories); 5__1.AddRange(5__5); 5__5 = null; } catch (Exception ex) { 5__6 = ex; ((BaseUnityPlugin)<>4__this).Logger.LogError((object)("[BoomboxCustomMusic] Error searching files: " + 5__6.Message)); } 5__4 = null; } <>s__2 = null; 5__1.Sort(); <>s__7 = 5__1.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -4; if ((int)5__12.result == 1) { 5__13 = DownloadHandlerAudioClip.GetContent(5__12); if ((Object)(object)5__13 != (Object)null) { ((Object)5__13).name = Path.GetFileNameWithoutExtension(5__8); CustomClips.Add(5__13); ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)("[BoomboxCustomMusic] Successfully loaded: " + ((Object)5__13).name)); } 5__13 = null; } <>m__Finally2(); 5__12 = null; 5__10 = null; 5__11 = null; 5__8 = null; break; } if (<>s__7.MoveNext()) { 5__8 = <>s__7.Current; 5__9 = (AudioType)0; 5__10 = Path.GetExtension(5__8).ToLower(); if (5__10 == ".mp3") { 5__9 = (AudioType)13; } else if (5__10 == ".wav") { 5__9 = (AudioType)20; } else if (5__10 == ".ogg") { 5__9 = (AudioType)14; } else if (5__10 == ".flac") { 5__9 = (AudioType)24; } 5__11 = "file://" + 5__8; 5__12 = UnityWebRequestMultimedia.GetAudioClip(5__11, 5__9); <>1__state = -4; <>2__current = 5__12.SendWebRequest(); <>1__state = 1; return true; } <>m__Finally1(); <>s__7 = default(List.Enumerator); ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)$"[BoomboxCustomMusic] Scan complete. Total tracks loaded: {CustomClips.Count}"); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__7).Dispose(); } private void <>m__Finally2() { <>1__state = -3; if (5__12 != null) { ((IDisposable)5__12).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__16 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ConfigEntry configEntry; public BoomBoxMoreCustomMusic <>4__this; private bool 5__1; private IEnumerator <>s__2; private KeyCode 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Invalid comparison between Unknown and I4 //IL_00a2: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = true; ((ConfigEntryBase)configEntry).BoxedValue = (object)(KeyCode)0; break; case 1: <>1__state = -1; break; } if (5__1) { <>s__2 = Enum.GetValues(typeof(KeyCode)).GetEnumerator(); try { while (<>s__2.MoveNext()) { 5__3 = (KeyCode)<>s__2.Current; if (Input.GetKeyDown(5__3) && (int)5__3 != 292) { configEntry.Value = 5__3; 5__1 = false; return false; } } } finally { if (<>s__2 is IDisposable disposable) { disposable.Dispose(); } } <>s__2 = null; <>2__current = null; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static List CustomClips = new List(); public static int CurrentTrackIndex = 0; public static string modPath; public static string CurrentTrackName = "None"; public static ConfigEntry KeyNextTrack; public static ConfigEntry KeyPrevTrack; public static ConfigEntry KeyResetQueue; private bool showMenu = false; private Rect windowRect = new Rect(100f, 100f, 300f, 260f); private static readonly string[] audioExtensions = new string[4] { "*.mp3", "*.wav", "*.ogg", "*.flac" }; private void Awake() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown modPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); KeyNextTrack = ((BaseUnityPlugin)this).Config.Bind("Controls", "NextTrackKey", (KeyCode)121, "Key to play next track"); KeyPrevTrack = ((BaseUnityPlugin)this).Config.Bind("Controls", "PrevTrackKey", (KeyCode)117, "Key to play previous track"); KeyResetQueue = ((BaseUnityPlugin)this).Config.Bind("Controls", "ResetQueueKey", (KeyCode)98, "Key to reset playlist to first track"); Harmony val = new Harmony("com.bublensky.BoomBoxCustom"); ((MonoBehaviour)this).StartCoroutine(LoadTracks()); val.PatchAll(); } [IteratorStateMachine(typeof(d__11))] private IEnumerator LoadTracks() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__11(0) { <>4__this = this }; } private void Update() { if (Input.GetKeyDown((KeyCode)292)) { showMenu = !showMenu; if (showMenu) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } else { Cursor.lockState = (CursorLockMode)1; Cursor.visible = false; } } } private void OnGUI() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (showMenu) { windowRect = GUILayout.Window(0, windowRect, new WindowFunction(DrawMenuWindow), "Boombox Settings (F11)", Array.Empty()); } } private void DrawMenuWindow(int windowID) { GUILayout.Space(10f); GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty()); GUILayout.Label("Now Playing:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(260f) }); GUILayout.Label("" + CurrentTrackName + "", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(260f) }); GUILayout.EndVertical(); GUILayout.Space(5f); GUILayout.Label($"Tracks loaded in playlist: {CustomClips.Count}", Array.Empty()); GUILayout.Space(15f); GUILayout.Label("--- Keybinds (Press to change) ---", Array.Empty()); DrawKeybindButton("Next Track", KeyNextTrack); DrawKeybindButton("Prev Track", KeyPrevTrack); DrawKeybindButton("Reset Playlist", KeyResetQueue); GUILayout.Space(15f); if (GUILayout.Button("Save & Close", Array.Empty())) { ((BaseUnityPlugin)this).Config.Save(); showMenu = false; Cursor.lockState = (CursorLockMode)1; Cursor.visible = false; } GUI.DragWindow(); } private void DrawKeybindButton(string label, ConfigEntry configEntry) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(label + ":", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); KeyCode value = configEntry.Value; if (GUILayout.Button(((object)(KeyCode)(ref value)).ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) })) { ((MonoBehaviour)this).StartCoroutine(WaitForKeyPress(configEntry)); } GUILayout.EndHorizontal(); } [IteratorStateMachine(typeof(d__16))] private IEnumerator WaitForKeyPress(ConfigEntry configEntry) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__16(0) { <>4__this = this, configEntry = configEntry }; } } [HarmonyPatch(typeof(ValuableBoombox), "Update")] internal class BoomboxUpdatePatch { private static void Postfix(ValuableBoombox __instance) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) if (BoomBoxMoreCustomMusic.CustomClips.Count == 0) { return; } PhysGrabObject value = Traverse.Create((object)__instance).Field("physGrabObject").GetValue(); if (!((Object)(object)value != (Object)null) || !value.grabbed) { if ((Object)(object)__instance.speaker1 != (Object)null) { __instance.speaker1.localScale = Vector3.one; } if ((Object)(object)__instance.speaker2 != (Object)null) { __instance.speaker2.localScale = Vector3.one; } return; } AudioSource val = null; if (__instance.soundBoomboxMusic != null) { val = Traverse.Create((object)__instance.soundBoomboxMusic).Field("source").GetValue(); } if ((Object)(object)val == (Object)null) { val = ((Component)__instance).GetComponentInChildren(); } if ((Object)(object)val != (Object)null) { val.mute = false; if ((Object)(object)val.clip != (Object)null) { BoomBoxMoreCustomMusic.CurrentTrackName = ((Object)val.clip).name; } else { BoomBoxMoreCustomMusic.CurrentTrackName = "None"; } if (Input.GetKeyDown(BoomBoxMoreCustomMusic.KeyNextTrack.Value)) { BoomBoxMoreCustomMusic.CurrentTrackIndex = (BoomBoxMoreCustomMusic.CurrentTrackIndex + 1) % BoomBoxMoreCustomMusic.CustomClips.Count; val.clip = BoomBoxMoreCustomMusic.CustomClips[BoomBoxMoreCustomMusic.CurrentTrackIndex]; val.time = 0f; val.Play(); Debug.Log((object)("[BoomboxCustomMusic] Next track: " + ((Object)val.clip).name)); } if (Input.GetKeyDown(BoomBoxMoreCustomMusic.KeyPrevTrack.Value)) { BoomBoxMoreCustomMusic.CurrentTrackIndex = (BoomBoxMoreCustomMusic.CurrentTrackIndex - 1 + BoomBoxMoreCustomMusic.CustomClips.Count) % BoomBoxMoreCustomMusic.CustomClips.Count; val.clip = BoomBoxMoreCustomMusic.CustomClips[BoomBoxMoreCustomMusic.CurrentTrackIndex]; val.time = 0f; val.Play(); Debug.Log((object)("[BoomboxCustomMusic] Previous track: " + ((Object)val.clip).name)); } if (Input.GetKeyDown(BoomBoxMoreCustomMusic.KeyResetQueue.Value)) { BoomBoxMoreCustomMusic.CurrentTrackIndex = 0; val.clip = BoomBoxMoreCustomMusic.CustomClips[0]; val.time = 0f; val.Play(); Debug.Log((object)"[BoomboxCustomMusic] Playlist reset to first track."); } if (!BoomBoxMoreCustomMusic.CustomClips.Contains(val.clip)) { BoomBoxMoreCustomMusic.CurrentTrackIndex %= BoomBoxMoreCustomMusic.CustomClips.Count; val.clip = BoomBoxMoreCustomMusic.CustomClips[BoomBoxMoreCustomMusic.CurrentTrackIndex]; val.time = 0f; val.Play(); } if ((Object)(object)val.clip != (Object)null && val.isPlaying && val.time >= val.clip.length - 0.2f) { BoomBoxMoreCustomMusic.CurrentTrackIndex = (BoomBoxMoreCustomMusic.CurrentTrackIndex + 1) % BoomBoxMoreCustomMusic.CustomClips.Count; val.clip = BoomBoxMoreCustomMusic.CustomClips[BoomBoxMoreCustomMusic.CurrentTrackIndex]; val.time = 0f; val.Play(); } if (!val.isPlaying && (Object)(object)val.clip != (Object)null) { val.Play(); } float num = 1f + Mathf.Sin(Time.time * 60f) * 0.012f; if ((Object)(object)__instance.speaker1 != (Object)null) { __instance.speaker1.localScale = new Vector3(num, num, num); } if ((Object)(object)__instance.speaker2 != (Object)null) { __instance.speaker2.localScale = new Vector3(num, num, num); } } } }