Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of BoomBoxMoreCustomMusic v1.2.0
BoomBoxMoreCustomMusic.dll
Decompiled 2 weeks agousing 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 <LoadTracks>d__11 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public BoomBoxMoreCustomMusic <>4__this; private List<string> <foundFiles>5__1; private string[] <>s__2; private int <>s__3; private string <extension>5__4; private string[] <files>5__5; private Exception <ex>5__6; private List<string>.Enumerator <>s__7; private string <filePath>5__8; private AudioType <audioType>5__9; private string <ext>5__10; private string <fileUrl>5__11; private UnityWebRequest <multimediaRequest>5__12; private AudioClip <clip>5__13; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadTracks>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(); } } <foundFiles>5__1 = null; <>s__2 = null; <extension>5__4 = null; <files>5__5 = null; <ex>5__6 = null; <>s__7 = default(List<string>.Enumerator); <filePath>5__8 = null; <ext>5__10 = null; <fileUrl>5__11 = null; <multimediaRequest>5__12 = null; <clip>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; } <foundFiles>5__1 = new List<string>(); <>s__2 = audioExtensions; for (<>s__3 = 0; <>s__3 < <>s__2.Length; <>s__3++) { <extension>5__4 = <>s__2[<>s__3]; try { <files>5__5 = Directory.GetFiles(modPath, <extension>5__4, SearchOption.AllDirectories); <foundFiles>5__1.AddRange(<files>5__5); <files>5__5 = null; } catch (Exception ex) { <ex>5__6 = ex; ((BaseUnityPlugin)<>4__this).Logger.LogError((object)("[BoomboxCustomMusic] Error searching files: " + <ex>5__6.Message)); } <extension>5__4 = null; } <>s__2 = null; <foundFiles>5__1.Sort(); <>s__7 = <foundFiles>5__1.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -4; if ((int)<multimediaRequest>5__12.result == 1) { <clip>5__13 = DownloadHandlerAudioClip.GetContent(<multimediaRequest>5__12); if ((Object)(object)<clip>5__13 != (Object)null) { ((Object)<clip>5__13).name = Path.GetFileNameWithoutExtension(<filePath>5__8); CustomClips.Add(<clip>5__13); ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)("[BoomboxCustomMusic] Successfully loaded: " + ((Object)<clip>5__13).name)); } <clip>5__13 = null; } <>m__Finally2(); <multimediaRequest>5__12 = null; <ext>5__10 = null; <fileUrl>5__11 = null; <filePath>5__8 = null; break; } if (<>s__7.MoveNext()) { <filePath>5__8 = <>s__7.Current; <audioType>5__9 = (AudioType)0; <ext>5__10 = Path.GetExtension(<filePath>5__8).ToLower(); if (<ext>5__10 == ".mp3") { <audioType>5__9 = (AudioType)13; } else if (<ext>5__10 == ".wav") { <audioType>5__9 = (AudioType)20; } else if (<ext>5__10 == ".ogg") { <audioType>5__9 = (AudioType)14; } else if (<ext>5__10 == ".flac") { <audioType>5__9 = (AudioType)24; } <fileUrl>5__11 = "file://" + <filePath>5__8; <multimediaRequest>5__12 = UnityWebRequestMultimedia.GetAudioClip(<fileUrl>5__11, <audioType>5__9); <>1__state = -4; <>2__current = <multimediaRequest>5__12.SendWebRequest(); <>1__state = 1; return true; } <>m__Finally1(); <>s__7 = default(List<string>.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 (<multimediaRequest>5__12 != null) { ((IDisposable)<multimediaRequest>5__12).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <WaitForKeyPress>d__16 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ConfigEntry<KeyCode> configEntry; public BoomBoxMoreCustomMusic <>4__this; private bool <waiting>5__1; private IEnumerator <>s__2; private KeyCode <kcode>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForKeyPress>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; <waiting>5__1 = true; ((ConfigEntryBase)configEntry).BoxedValue = (object)(KeyCode)0; break; case 1: <>1__state = -1; break; } if (<waiting>5__1) { <>s__2 = Enum.GetValues(typeof(KeyCode)).GetEnumerator(); try { while (<>s__2.MoveNext()) { <kcode>5__3 = (KeyCode)<>s__2.Current; if (Input.GetKeyDown(<kcode>5__3) && (int)<kcode>5__3 != 292) { configEntry.Value = <kcode>5__3; <waiting>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<AudioClip> CustomClips = new List<AudioClip>(); public static int CurrentTrackIndex = 0; public static string modPath; public static string CurrentTrackName = "None"; public static ConfigEntry<KeyCode> KeyNextTrack; public static ConfigEntry<KeyCode> KeyPrevTrack; public static ConfigEntry<KeyCode> 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<KeyCode>("Controls", "NextTrackKey", (KeyCode)121, "Key to play next track"); KeyPrevTrack = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "PrevTrackKey", (KeyCode)117, "Key to play previous track"); KeyResetQueue = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("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(<LoadTracks>d__11))] private IEnumerator LoadTracks() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadTracks>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<GUILayoutOption>()); } } private void DrawMenuWindow(int windowID) { GUILayout.Space(10f); GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>()); GUILayout.Label("<b>Now Playing:</b>", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(260f) }); GUILayout.Label("<color=yellow>" + CurrentTrackName + "</color>", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(260f) }); GUILayout.EndVertical(); GUILayout.Space(5f); GUILayout.Label($"Tracks loaded in playlist: {CustomClips.Count}", Array.Empty<GUILayoutOption>()); GUILayout.Space(15f); GUILayout.Label("--- Keybinds (Press to change) ---", Array.Empty<GUILayoutOption>()); DrawKeybindButton("Next Track", KeyNextTrack); DrawKeybindButton("Prev Track", KeyPrevTrack); DrawKeybindButton("Reset Playlist", KeyResetQueue); GUILayout.Space(15f); if (GUILayout.Button("Save & Close", Array.Empty<GUILayoutOption>())) { ((BaseUnityPlugin)this).Config.Save(); showMenu = false; Cursor.lockState = (CursorLockMode)1; Cursor.visible = false; } GUI.DragWindow(); } private void DrawKeybindButton(string label, ConfigEntry<KeyCode> 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<GUILayoutOption>()); 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(<WaitForKeyPress>d__16))] private IEnumerator WaitForKeyPress(ConfigEntry<KeyCode> configEntry) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForKeyPress>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<PhysGrabObject>(); 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<AudioSource>(); } if ((Object)(object)val == (Object)null) { val = ((Component)__instance).GetComponentInChildren<AudioSource>(); } 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); } } } }