The BepInEx console will not appear when launching like it does for other games on Thunderstore (you can turn it back on in your BepInEx.cfg file). If your PEAK crashes on startup, add -dx12 to your launch parameters.
Decompiled source of RainWorld Music v0.9.0
RainWorldPEAK.dll
Decompiled 4 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")] internal class RainWorldInfo : BaseUnityPlugin { public const string modGUID = "Rissoe.RainWorldPEAK"; public const string modName = "Rain World Music"; public const string modVersion = "0.9.0"; private readonly Harmony harmony = new Harmony("Rissoe.RainWorldPEAK"); private void Awake() { harmony.PatchAll(); Debug.Log((object)"Rain World Music loaded!"); } } internal 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))] private IEnumerator SoundAdder() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SoundAdder>d__2(0) { <>4__this = this }; } } [HarmonyPatch(typeof(MainMenuMainPage))] internal static class RainWorldPatch { internal static GameObject MusicPlayer; internal static AudioSource MusicSource; internal static SoundStuff MusicStuff; [HarmonyPatch("Start")] [HarmonyPostfix] private 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); } GameObject.Find("Title Music").SetActive(false); } [HarmonyPatch("Update")] [HarmonyPostfix] private static void PlayMenuMusicFix() { if ((Object)(object)MusicPlayer != (Object)null && !PhotonNetwork.InRoom && (Object)(object)MusicSource.clip != (Object)(object)MusicStuff.clips.ElementAt(6)) { MusicSource.Stop(); MusicSource.clip = MusicStuff.clips.ElementAt(6); MusicSource.loop = true; MusicSource.Play(); } } } [HarmonyPatch(typeof(FloatSetting))] internal static class ChangeVolume { [HarmonyPatch("Save")] [HarmonyPostfix] private 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.*/)] internal static class StopMainMenuMusic { [HarmonyPatch("LoadLevel")] [HarmonyPostfix] private static void SetupFix() { RainWorldPatch.MusicSource.loop = false; RainWorldPatch.MusicSource.Stop(); } } [HarmonyPatch(typeof(AmbienceAudio))] internal static class VanillaMusicRemoverPatch { [HarmonyPatch("FixedUpdate")] [HarmonyPrefix] private static bool DisableFix() { return false; } } [HarmonyPatch(typeof(MapHandler))] internal static class MusicReplacerPatch { internal static float Timer; internal static Campfire fire; internal static int SpecialSegment; [HarmonyPatch("Update")] [HarmonyPostfix] private static void MusicFix(MapHandler __instance) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected I4, but got Unknown if (Character.localCharacter.refs.stats.won || Character.localCharacter.refs.stats.somebodyElseWon) { 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 > 2120f && SpecialSegment == 0)) { RainWorldPatch.MusicSource.Stop(); if (Character.localCharacter.Center.z > 2120f) { RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(5); RainWorldPatch.MusicSource.loop = true; SpecialSegment = 1; } 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; case 4: RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(4); break; default: RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(6); break; } } Timer = Random.Range(150, 300); RainWorldPatch.MusicSource.Play(); } else if (!RainWorldPatch.MusicSource.isPlaying) { Timer -= Time.deltaTime; } } } [HarmonyPatch(typeof(Character))] internal static class VictoryMusic { [HarmonyPatch("Start")] [HarmonyPostfix] private static void AirportMusicGone(Character __instance) { if (__instance.IsLocal && (Object)(object)GameObject.Find("MountainProgress") == (Object)null) { Object.Destroy((Object)(object)GameObject.Find("Music Airport")); } } [HarmonyPatch("Update")] [HarmonyPostfix] private static void CheckpointFix(Character __instance) { if (__instance.IsLocal && (Character.localCharacter.refs.stats.won || Character.localCharacter.refs.stats.somebodyElseWon) && MusicReplacerPatch.SpecialSegment < 2) { RainWorldPatch.MusicSource.Stop(); RainWorldPatch.MusicSource.loop = true; RainWorldPatch.MusicSource.clip = RainWorldPatch.MusicStuff.clips.ElementAt(10); RainWorldPatch.MusicSource.Play(); MusicReplacerPatch.SpecialSegment = 2; } else if (__instance.IsLocal && (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(); MusicReplacerPatch.Timer = 0f; MusicReplacerPatch.fire = null; MusicReplacerPatch.SpecialSegment = 0; GameObject.Find("Music Airport").SetActive(false); } } } [HarmonyPatch(typeof(Campfire))] internal static class CampfireMusicPatch { [HarmonyPatch("Light_Rpc")] [HarmonyPostfix] private 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(6); break; } MusicReplacerPatch.fire = __instance; RainWorldPatch.MusicSource.Play(); MusicReplacerPatch.Timer = 600f; } }