Please disclose if your mod was created primarily 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 Sigma Boombox Music v1.0.0
Boombox Lethal Company.dll
Decompiled 10 months 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.Logging; using Boombox_Lethal_Company.AudioPreloader; using Boombox_Lethal_Company.Patches; 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("Boombox Lethal Company")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Boombox Lethal Company")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("1c71fa6c-88d5-4ef1-9a3b-2f0bba3d37c6")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace Boombox_Lethal_Company { [BepInPlugin("Bomb.BoomboxMod", "Boombox Mod", "1.0.0.0")] public class BoomboxMod : BaseUnityPlugin { private const string modGUID = "Bomb.BoomboxMod"; private const string modName = "Boombox Mod"; private const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("Bomb.BoomboxMod"); private static BoomboxMod Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Bomb.BoomboxMod"); mls.LogInfo((object)"Boombox mod activated"); harmony.PatchAll(typeof(BoomboxMod)); harmony.PatchAll(typeof(BoomboxAudioManager)); harmony.PatchAll(typeof(Boombox)); } } } namespace Boombox_Lethal_Company.Patches { [HarmonyPatch(typeof(BoomboxItem))] internal class Boombox { [HarmonyPatch("ItemActivate")] [HarmonyPostfix] private static void AddBoomboxSoundPatch(BoomboxItem __instance) { FieldInfo fieldInfo = AccessTools.Field(typeof(BoomboxItem), "musicAudios"); if (fieldInfo != null) { AudioClip[] first = (AudioClip[])fieldInfo.GetValue(__instance); List<AudioClip> list = (from clip in first.Concat(BoomboxAudioManager.preloadedAudioClips) group clip by ((Object)clip).name into @group select @group.First()).ToList(); fieldInfo.SetValue(__instance, list.ToArray()); Debug.Log((object)"Boombox updated with unique preloaded sounds."); Debug.Log((object)$"Amount of songs in boombox: {list.Count}"); Debug.Log((object)BoomboxAudioManager.preloadedAudioClips.Count); } } } } namespace Boombox_Lethal_Company.AudioPreloader { internal class BoomboxAudioManager : MonoBehaviour { [CompilerGenerated] private sealed class <>c__DisplayClass5_0 { public AudioClip newClip; internal bool <PreloadMp3Files>b__0(AudioClip clip) { return ((Object)clip).name == ((Object)newClip).name; } } [CompilerGenerated] private sealed class <PreloadMp3Files>d__5 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private string <songsFolder>5__1; private string[] <>s__2; private int <>s__3; private string <filePath>5__4; private string <formattedPath>5__5; private UnityWebRequest <request>5__6; private <>c__DisplayClass5_0 <>8__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PreloadMp3Files>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <songsFolder>5__1 = null; <>s__2 = null; <filePath>5__4 = null; <formattedPath>5__5 = null; <request>5__6 = null; <>8__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Invalid comparison between Unknown and I4 switch (<>1__state) { default: return false; case 0: <>1__state = -1; <songsFolder>5__1 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Songs/"); Debug.Log((object)("songs folder path: " + <songsFolder>5__1)); Debug.Log((object)"Preloading MP3 files..."); if (!Directory.Exists(<songsFolder>5__1)) { Debug.LogWarning((object)"Songs folder does not exist!"); return false; } Debug.Log((object)"attempting to start mp3 file for loop"); <>s__2 = Directory.GetFiles(<songsFolder>5__1, "*.mp3"); <>s__3 = 0; break; case 1: <>1__state = -1; if ((int)<request>5__6.result == 1) { <>8__7 = new <>c__DisplayClass5_0(); <>8__7.newClip = DownloadHandlerAudioClip.GetContent(<request>5__6); ((Object)<>8__7.newClip).name = Path.GetFileNameWithoutExtension(<filePath>5__4); Debug.Log((object)"unity web request is success"); if (!preloadedAudioClips.Any((AudioClip clip) => ((Object)clip).name == ((Object)<>8__7.newClip).name)) { preloadedAudioClips.Add(<>8__7.newClip); Debug.Log((object)("Preloaded MP3: " + ((Object)<>8__7.newClip).name)); } <>8__7 = null; } else { Debug.LogError((object)("Failed to preload MP3 file: " + <request>5__6.error)); } <formattedPath>5__5 = null; <request>5__6 = null; <filePath>5__4 = null; <>s__3++; break; } if (<>s__3 < <>s__2.Length) { <filePath>5__4 = <>s__2[<>s__3]; Debug.Log((object)"executed mp3 for loop"); Debug.Log((object)<filePath>5__4); <formattedPath>5__5 = "file:///" + <filePath>5__4.Replace("\\", "/"); <request>5__6 = UnityWebRequestMultimedia.GetAudioClip(<formattedPath>5__5, (AudioType)13); if (<request>5__6 == null) { Debug.LogError((object)"UnityWebRequest failed to initialize!"); return false; } <>2__current = <request>5__6.SendWebRequest(); <>1__state = 1; return true; } <>s__2 = null; 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(); } } private static BoomboxAudioManager instance; public static List<AudioClip> preloadedAudioClips = new List<AudioClip>(); public static BoomboxAudioManager Instance { get { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown if ((Object)(object)instance == (Object)null) { instance = Object.FindObjectOfType<BoomboxAudioManager>(); if ((Object)(object)instance == (Object)null) { GameObject val = new GameObject("BoomboxAudioManager"); instance = val.AddComponent<BoomboxAudioManager>(); Object.DontDestroyOnLoad((Object)(object)val); } } return instance; } } [HarmonyPatch(typeof(BoomboxItem), "Start")] [HarmonyPostfix] private static void StartScript() { Debug.Log((object)"starting boombox audio manager script!"); ((MonoBehaviour)Instance).StartCoroutine(PreloadMp3Files()); Debug.Log((object)"started boombox audio manager script!"); } [IteratorStateMachine(typeof(<PreloadMp3Files>d__5))] public static IEnumerator PreloadMp3Files() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PreloadMp3Files>d__5(0); } } }