The BepInEx console will not appear when launching like it does for other games on Thunderstore. This is normal (and helps prevent crashes during startup). You can turn it back on in your BepInEx.cfg file.
Decompiled source of RainWorld Music v0.8.0
RainWorldPEAK.dll
Decompiled 5 days 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 HarmonyLib; using Photon.Pun; using UnityEngine; using UnityEngine.Networking; using Zorro.Settings; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("RainWorldPEAK")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RainWorldPEAK")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f610855c-276d-4499-b289-bede158173ef")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace RainWorldMusicMod; [BepInPlugin("Rissoe.RainWorldPEAK", "Rain World Music", "0.8.0")] public class RainWorldInfo : BaseUnityPlugin { public const string modGUID = "Rissoe.RainWorldPEAK"; public const string modName = "Rain World Music"; public const string modVersion = "0.8.0"; private readonly Harmony harmony = new Harmony("Rissoe.RainWorldPEAK"); private void Awake() { harmony.PatchAll(); Debug.Log((object)"Rain World Music loaded!"); } } public class SoundStuff : MonoBehaviour { [CompilerGenerated] private sealed class <SoundAdder>d__2 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public SoundStuff <>4__this; private Assembly <assembly>5__1; private string <tempPath>5__2; private int <i>5__3; private Stream <stream>5__4; private byte[] <data>5__5; private UnityWebRequest <www>5__6; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SoundAdder>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <assembly>5__1 = null; <tempPath>5__2 = null; <stream>5__4 = null; <data>5__5 = null; <www>5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Invalid comparison between Unknown and I4 //IL_0137: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; if ((int)<www>5__6.result == 1) { <>4__this.clips.Add(DownloadHandlerAudioClip.GetContent(<www>5__6)); } else { Debug.LogError((object)("[RainWorldMusic] Error downloading Audio: " + <www>5__6.error)); } <data>5__5 = null; <www>5__6 = null; goto IL_01c2; } <>1__state = -1; <assembly>5__1 = Assembly.GetExecutingAssembly(); <tempPath>5__2 = ""; <i>5__3 = 1; goto IL_01da; IL_01da: if (<i>5__3 <= 11) { <stream>5__4 = <assembly>5__1.GetManifestResourceStream("RainWorldPEAK.Level" + <i>5__3 + ".mp3"); if (<stream>5__4 == null) { Debug.Log((object)"[RainWordMusic] Could not find Sound!"); goto IL_01c2; } <data>5__5 = new byte[<stream>5__4.Length]; <stream>5__4.Read(<data>5__5, 0, <data>5__5.Length); <tempPath>5__2 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "tmp.mp3"); <tempPath>5__2 = <tempPath>5__2.Replace("\\", "/"); File.WriteAllBytes(<tempPath>5__2, <data>5__5); <www>5__6 = UnityWebRequestMultimedia.GetAudioClip("file://" + <tempPath>5__2, (AudioType)13); ((DownloadHandlerAudioClip)<www>5__6.downloadHandler).streamAudio = true; <>2__current = <www>5__6.SendWebRequest(); <>1__state = 1; return true; } File.Delete(<tempPath>5__2); Debug.Log((object)"[RainWorldMusic] Loaded songs!"); return false; IL_01c2: <stream>5__4 = null; <i>5__3++; goto IL_01da; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal List<AudioClip> clips = new List<AudioClip>(); private void Start() { ((MonoBehaviour)this).StartCoroutine(SoundAdder()); } [IteratorStateMachine(typeof(<SoundAdder>d__2))] public IEnumerator SoundAdder() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SoundAdder>d__2(0) { <>4__this = this }; } } [HarmonyPatch(typeof(MainMenuMainPage))] public static class RainWorldPatch { internal static GameObject MusicPlayer; internal static AudioSource MusicSource; internal static SoundStuff MusicStuff; [HarmonyPatch("Start")] [HarmonyPostfix] public static void SetupFix() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown if ((Object)(object)MusicPlayer == (Object)null) { MusicPlayer = new GameObject("RainWorldMusicMod"); MusicStuff = MusicPlayer.AddComponent<SoundStuff>(); MusicSource = MusicPlayer.AddComponent<AudioSource>(); MusicSource.minDistance = 999999f; MusicSource.bypassEffects = true; MusicSource.bypassReverbZones = true; MusicSource.volume = ((FloatSetting)GameHandler.Instance.SettingsHandler.GetSetting<MusicVolumeSetting>()).Value; Object.DontDestroyOnLoad((Object)(object)MusicPlayer); } } [HarmonyPatch("Update")] [HarmonyPostfix] public static void PlayMenuMusicFix() { if ((Object)(object)MusicPlayer != (Object)null && MusicStuff.clips.Count == 10 && !MusicSource.isPlaying && !PhotonNetwork.InRoom) { MusicSource.clip = MusicStuff.clips.ElementAt(6); MusicSource.loop = true; MusicSource.Play(); } } } [HarmonyPatch(typeof(FloatSetting))] public static class ChangeVolume { [HarmonyPatch("Save")] [HarmonyPostfix] public static void SetupFix(FloatSetting __instance) { if ((Object)(object)RainWorldPatch.MusicSource != (Object)null) { RainWorldPatch.MusicSource.volume = __instance.Value; } } } [HarmonyPatch(typeof(PhotonNetwork))] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static class StopMainMenuMusic { [HarmonyPatch("LoadLevel")] [HarmonyPostfix] public static void SetupFix() { RainWorldPatch.MusicSource.loop = false; RainWorldPatch.MusicSource.Stop(); } } [HarmonyPatch(typeof(AmbienceAudio))] public static class VanillaMusicRemoverPatch { [HarmonyPatch("FixedUpdate")] [HarmonyPrefix] public static bool DisableFix() { return false; } } [HarmonyPatch(typeof(MapHandler))] public static class MusicReplacerPatch { internal static float Timer; internal static Campfire fire; internal static int SpecialSegment; [HarmonyPatch("Update")] [HarmonyPostfix] public static void MusicFix(MapHandler __instance) { //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Expected I4, but got Unknown //IL_01eb: Unknown result type (might be due to invalid IL or missing references) if ((!PhotonNetwork.InRoom || (Object)(object)GameObject.Find("MountainProgress") == (Object)null) && (Object)(object)RainWorldPatch.MusicSource.clip != (Object)(object)RainWorldPatch.MusicStuff.clips.ElementAt(6)) { RainWorldPatch.MusicSource.Stop(); RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(6); RainWorldPatch.MusicSource.loop = true; RainWorldPatch.MusicSource.Play(); Timer = 0f; fire = null; SpecialSegment = 0; return; } if (Character.localCharacter.refs.stats.won || Character.localCharacter.refs.stats.somebodyElseWon) { RainWorldPatch.MusicSource.Stop(); RainWorldPatch.MusicSource.loop = true; RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(10); RainWorldPatch.MusicSource.Play(); SpecialSegment = 3; return; } if ((Object)(object)fire != (Object)null && Vector3.Distance(Character.localCharacter.Center, fire.Center()) > 50f) { fire = null; RainWorldPatch.MusicSource.Stop(); Timer = 0f; } if (Timer <= 0f || (Character.localCharacter.Center.z > 1900f && SpecialSegment == 0) || (Character.localCharacter.Center.z > 2111f && SpecialSegment == 1)) { RainWorldPatch.MusicSource.Stop(); if (Character.localCharacter.Center.z > 1900f) { if (Character.localCharacter.Center.z > 2111f) { RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(5); SpecialSegment = 2; } else { RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(4); SpecialSegment = 1; } Timer = 0.01f; } else { Segment currentSegment = __instance.GetCurrentSegment(); Segment val = currentSegment; switch ((int)val) { case 0: RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(0); break; case 1: RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(1); break; case 2: RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(2); break; case 3: RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(3); break; default: RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(6); break; } Timer = Random.Range(120, 240); } RainWorldPatch.MusicSource.Play(); } else if (!RainWorldPatch.MusicSource.isPlaying) { Timer -= Time.deltaTime; } } } [HarmonyPatch(typeof(Campfire))] public static class CampfireMusicPatch { [HarmonyPatch("Light_Rpc")] [HarmonyPostfix] public static void CheckpointFix(Campfire __instance) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected I4, but got Unknown RainWorldPatch.MusicSource.Stop(); Segment advanceToSegment = __instance.advanceToSegment; Segment val = advanceToSegment; switch (val - 1) { case 0: RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(6); break; case 1: RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(7); break; case 2: RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(8); break; case 3: RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(9); break; default: RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(0); break; } MusicReplacerPatch.fire = __instance; RainWorldPatch.MusicSource.Play(); MusicReplacerPatch.Timer = Random.Range(60, 120); } }