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 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.0.1")] public class BoomBoxMoreCustomMusic : BaseUnityPlugin { [CompilerGenerated] private sealed class d__5 : 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 List.Enumerator <>s__5; private string 5__6; private string 5__7; private AudioType 5__8; private UnityWebRequest 5__9; private AudioClip 5__10; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__5(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; <>s__5 = default(List.Enumerator); 5__6 = null; 5__7 = null; 5__9 = null; 5__10 = null; <>1__state = -2; } private bool MoveNext() { //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Invalid comparison between Unknown and I4 //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 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]; 5__1.AddRange(Directory.GetFiles(modPath, 5__4)); 5__4 = null; } <>s__2 = null; 5__1.Sort(); <>s__5 = 5__1.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -4; if ((int)5__9.result == 1) { 5__10 = DownloadHandlerAudioClip.GetContent(5__9); ((Object)5__10).name = Path.GetFileNameWithoutExtension(5__6); CustomClips.Add(5__10); Debug.Log((object)("[BoomboxCustomMusic] Loaded: " + ((Object)5__10).name)); 5__10 = null; } else { Debug.Log((object)("[BoomboxCustomMusic] Failed to load: " + 5__6 + " (" + 5__9.error + ")")); } <>m__Finally2(); 5__9 = null; 5__7 = null; 5__6 = null; break; } if (<>s__5.MoveNext()) { 5__6 = <>s__5.Current; 5__7 = "file://" + Path.GetFullPath(5__6); 5__8 = (AudioType)0; if (5__6.EndsWith(".mp3")) { 5__8 = (AudioType)13; } else if (5__6.EndsWith(".wav")) { 5__8 = (AudioType)20; } else if (5__6.EndsWith(".ogg")) { 5__8 = (AudioType)14; } else if (5__6.EndsWith(".aiff")) { 5__8 = (AudioType)2; } else if (5__6.EndsWith(".flac")) { 5__8 = (AudioType)0; } 5__9 = UnityWebRequestMultimedia.GetAudioClip(5__7, 5__8); <>1__state = -4; <>2__current = 5__9.SendWebRequest(); <>1__state = 1; return true; } <>m__Finally1(); <>s__5 = default(List.Enumerator); Debug.Log((object)$"[BoomboxCustomMusic] 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__5).Dispose(); } private void <>m__Finally2() { <>1__state = -3; if (5__9 != null) { ((IDisposable)5__9).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static List CustomClips = new List(); public static int CurrentTrackIndex = 0; public static string modPath; private static readonly string[] audioExtensions = new string[5] { "*.mp3", "*.wav", "*.ogg", "*.aiff", "*.flac" }; private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown modPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); Harmony val = new Harmony("com.bublensky.BoomBoxCustom"); ((MonoBehaviour)this).StartCoroutine(LoadTracks()); val.PatchAll(); } [IteratorStateMachine(typeof(d__5))] private IEnumerator LoadTracks() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__5(0) { <>4__this = this }; } } [HarmonyPatch(typeof(ValuableBoombox), "Update")] internal class BoomboxUpdatePatch { private static void Postfix(ValuableBoombox __instance) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0292: 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)) { if (!BoomBoxMoreCustomMusic.CustomClips.Contains(val.clip)) { BoomBoxMoreCustomMusic.CurrentTrackIndex %= BoomBoxMoreCustomMusic.CustomClips.Count; val.clip = BoomBoxMoreCustomMusic.CustomClips[BoomBoxMoreCustomMusic.CurrentTrackIndex]; val.time = 0f; Debug.Log((object)("[BoomboxCustomMusic] Replacing clip with: " + ((Object)val.clip).name)); } 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(); Debug.Log((object)("[BoomboxCustomMusic] Next track: " + ((Object)val.clip).name)); } if (!val.isPlaying && (Object)(object)val.clip != (Object)null) { val.Play(); Debug.Log((object)"[BoomboxCustomMusic] Audio restarted"); } val.volume = 1f; val.mute = false; 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); } } } }