RUMBLE does not support other mod managers. If you want to use a manager, you must use the RUMBLE Mod Manager, a manager specifically designed for this game.
Decompiled source of RumbleMediaControls v1.0.3
Mods/RumbleMediaControlBinds.dll
Decompiled 2 days agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using Il2CppRUMBLE.Interactions.InteractionBase; using Il2CppRUMBLE.Players; using Il2CppTMPro; using MelonLoader; using NAudio.CoreAudioApi; using RumbleMediaControlBinds; using RumbleMediaControlBinds.ModUISchruff; using RumbleModUI; using RumbleModdingAPI; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Main), "Rumble Media Controls", "1.0.3", "oreotrollturbo", null)] [assembly: MelonGame("Buckethead Entertainment", "RUMBLE")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("RumbleMediaControlBinds")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RumbleMediaControlBinds")] [assembly: AssemblyTitle("RumbleMediaControlBinds")] [assembly: AssemblyVersion("1.0.0.0")] namespace RumbleMediaControlBinds { public class ButtonsNStuff { public class MediaMenu { private ButtonWithLabel nextButton; private ButtonWithLabel previousButton; private ButtonWithLabel playPauseButton; private GameObject mediaText; public GameObject root; public MediaMenu() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) root = new GameObject("RumbleMediaControls"); mediaText = Create.NewText("Media Controls", 2f, Color.white, new Vector3(0f, -30f, 0f), Quaternion.identity); ((Object)mediaText).name = "Media Controls"; mediaText.transform.SetParent(root.transform); TextMeshPro component = mediaText.GetComponent<TextMeshPro>(); ((TMP_Text)component).text = "Media Controls"; ((TMP_Text)component).enableWordWrapping = false; ((TMP_Text)component).overflowMode = (TextOverflowModes)0; playPauseButton = new ButtonWithLabel(new Vector3(0f, -0.5f, 0f), "Play", "PlayButton", root); nextButton = new ButtonWithLabel(new Vector3(0.25f, -0.25f, 0f), "Next", "NextButton", root); previousButton = new ButtonWithLabel(new Vector3(-0.25f, -0.25f, 0f), "Previous", "PreviousButton", root); ((Component)playPauseButton.button.transform.GetChild(0)).GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { MediaControls.PlayPause(); })); ((Component)nextButton.button.transform.GetChild(0)).GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { MediaControls.Next(); })); ((Component)previousButton.button.transform.GetChild(0)).GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { MediaControls.Previous(); })); root.SetActive(false); } public void HandleButtonPress() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) if (root.activeSelf) { root.SetActive(false); return; } root.SetActive(true); Transform child = ((Component)Players.GetLocalPlayer().Controller).transform.GetChild(2).GetChild(0).GetChild(0); Vector3 position = child.position + child.forward * 0.8f + new Vector3(0f, -0.1f, 0f); Vector3 forward = child.forward; forward.y = 0f; Quaternion rotation = Quaternion.identity; if (((Vector3)(ref forward)).sqrMagnitude > 0.001f) { rotation = Quaternion.LookRotation(((Vector3)(ref forward)).normalized, Vector3.up); } root.transform.position = position; root.transform.rotation = rotation; } public void Destroy() { Object.Destroy((Object)(object)root); } } public class ButtonWithLabel { public GameObject button; public GameObject label; public ButtonWithLabel(Vector3 localPosition, string labelText, string objectName, Transform parent) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) button = Create.NewButton(Vector3.zero, Quaternion.identity); ((Object)button).name = objectName; if ((Object)(object)parent != (Object)null) { button.transform.SetParent(parent, false); } button.transform.localPosition = localPosition; button.transform.localRotation = Quaternion.Euler(90f, 180f, 0f); label = Create.NewText(labelText, 0.5f, Color.white, Vector3.zero, Quaternion.identity); ((Object)label).name = objectName + " label"; label.transform.SetParent(button.transform, false); label.transform.localPosition = new Vector3(-0.33f, 0.1f, 0f); label.transform.localRotation = Quaternion.Euler(90f, 180f, 0f); TextMeshPro component = label.GetComponent<TextMeshPro>(); ((TMP_Text)component).text = labelText; ((TMP_Text)component).enableWordWrapping = false; ((TMP_Text)component).overflowMode = (TextOverflowModes)0; } public ButtonWithLabel(Vector3 localPosition, string labelText, string objectName, GameObject parent) : this(localPosition, labelText, objectName, parent.transform) { }//IL_0001: Unknown result type (might be due to invalid IL or missing references) public void Destroy() { Object.Destroy((Object)(object)button); Object.Destroy((Object)(object)label); } } } public static class BuildInfo { public const string ModName = "Rumble Media Controls"; public const string ModVersion = "1.0.3"; public const string Description = "Adds a portable media controller rumbel :3 "; public const string Author = "oreotrollturbo"; } public class Main : MelonMod { private bool wasSpeaking; private ButtonsNStuff.MediaMenu _mediaMenu; private float lastBPressTime = -1f; private const float doubleTapTime = 0.7f; private bool bWasPressedLastFrame; private static float lastYPressTime = -1f; private static bool yWasPressedLastFrame = false; public override void OnLateInitializeMelon() { Calls.onMapInitialized += SceneLoaded; ModUIFunctions.InitModUI(); Calls.Log("Loading round listeners"); Calls.onRoundStarted += delegate { OnRoundStarted(); }; Calls.onRoundEnded += OnPlayerDefeated; } private void SceneLoaded() { if (!Scene.GetSceneName().Contains("Loader")) { MelonCoroutines.Start(TurnUpWithDelay(1f)); if (_mediaMenu != null) { _mediaMenu.Destroy(); } _mediaMenu = new ButtonsNStuff.MediaMenu(); } } public override void OnFixedUpdate() { float secondary = RightController.GetSecondary(); bool flag = secondary > 0.9f; if (flag && !bWasPressedLastFrame) { float time = Time.time; if (time - lastBPressTime <= 0.7f) { MediaControls.PlayPause(); lastBPressTime = -1f; } else { lastBPressTime = time; } } bWasPressedLastFrame = flag; if (!Scene.GetSceneName().Equals("Loader")) { float secondary2 = LeftController.GetSecondary(); bool flag2 = secondary2 > 0.9f; if (flag2 && !yWasPressedLastFrame) { float time2 = Time.time; if (time2 - lastYPressTime <= 0.7f) { _mediaMenu.HandleButtonPress(); lastYPressTime = -1f; } else { lastYPressTime = time2; } } yWasPressedLastFrame = flag2; } if (!Input.GetKeyDown((KeyCode)98)) { } } public bool isPlayerSpeaking(Player player) { GameObject gameObject = ((Component)((Component)player.Controller).gameObject.transform.GetChild(6).GetChild(1).GetChild(1) .GetChild(2)).gameObject; return gameObject.activeSelf; } public static void OnPlayerDefeated() { string sceneName = Scene.GetSceneName(); if (sceneName == "Map0" || sceneName == "Map1") { if (ModUIFunctions.shouldPauseOnRoundEnd) { MediaControls.PlayPause(); } else if (ModUIFunctions.turnDownDuringPillarSequence) { MelonCoroutines.Start(MediaControls.FadeApplicationVolume(ModUIFunctions.appName, ModUIFunctions.turnDownVolume, 0.8f)); } } } public static void OnRoundStarted() { if (ModUIFunctions.shouldResumeOnRoundStart) { MelonCoroutines.Start(ResumeWithDelay(1f)); } else if (ModUIFunctions.turnDownDuringPillarSequence) { MelonCoroutines.Start(TurnUpWithDelay(1f)); } } public static IEnumerator ResumeWithDelay(float delay) { yield return (object)new WaitForSeconds(delay); MediaControls.PlayPause(); } public static IEnumerator TurnUpWithDelay(float delay) { yield return (object)new WaitForSeconds(delay); MelonCoroutines.Start(MediaControls.FadeApplicationVolume(targetVolume: ModUIFunctions.turnUpVolume, appName: ModUIFunctions.appName, duration: 1.2f)); } } public class MediaControls { private const int WM_APPCOMMAND = 793; private const int APPCOMMAND_MEDIA_PLAY_PAUSE = 14; private const int APPCOMMAND_MEDIA_NEXTTRACK = 11; private const int APPCOMMAND_MEDIA_PREVIOUSTRACK = 12; private const int APPCOMMAND_MEDIA_STOP = 13; private const int APPCOMMAND_VOLUME_MUTE = 8; private const int APPCOMMAND_VOLUME_DOWN = 9; private const int APPCOMMAND_VOLUME_UP = 10; public static float cachedVolume = 1f; private static int? cachedProcessId; private static IntPtr GlobalWindow => GetShellWindow(); [DllImport("user32.dll")] private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp); [DllImport("user32.dll")] private static extern IntPtr GetForegroundWindow(); public static void PlayPause() { IntPtr foregroundWindow = GetForegroundWindow(); SendMessage(foregroundWindow, 793, foregroundWindow, (IntPtr)917504); } public static void Previous() { IntPtr foregroundWindow = GetForegroundWindow(); SendMessage(foregroundWindow, 793, foregroundWindow, (IntPtr)786432); } public static void Next() { IntPtr foregroundWindow = GetForegroundWindow(); SendMessage(foregroundWindow, 793, foregroundWindow, (IntPtr)720896); } public static void Stop() { IntPtr foregroundWindow = GetForegroundWindow(); SendMessage(foregroundWindow, 793, foregroundWindow, (IntPtr)851968); } public static void IncreaseVolume() { IntPtr foregroundWindow = GetForegroundWindow(); SendMessage(foregroundWindow, 793, foregroundWindow, (IntPtr)655360); } public static void DecreaseVolume() { IntPtr foregroundWindow = GetForegroundWindow(); SendMessage(foregroundWindow, 793, foregroundWindow, (IntPtr)589824); } public static void Mute() { IntPtr foregroundWindow = GetForegroundWindow(); SendMessage(foregroundWindow, 793, foregroundWindow, (IntPtr)524288); } [DllImport("user32.dll")] private static extern IntPtr GetShellWindow(); public static void IncreaseVolumeGlobal() { SendMessage(GlobalWindow, 793, GlobalWindow, (IntPtr)655360); } public static void DecreaseVolumeGlobal() { SendMessage(GlobalWindow, 793, GlobalWindow, (IntPtr)589824); } public static void MuteGlobal() { SendMessage(GlobalWindow, 793, GlobalWindow, (IntPtr)524288); } public static void SetApplicationVolume(string processName, float volume) { try { if (!cachedProcessId.HasValue) { Process[] processesByName = Process.GetProcessesByName(processName); int num = 0; if (num < processesByName.Length) { Process process = processesByName[num]; cachedProcessId = process.Id; } } if (cachedProcessId.HasValue) { SimpleAudioVolume val = FindSession(cachedProcessId.Value); if (val != null) { val.Volume = volume; cachedVolume = volume; } } } catch (Exception ex) { MelonLogger.Warning("Volume set failed: " + ex.Message); cachedProcessId = null; } } public static IEnumerator FadeApplicationVolume(string appName, float targetVolume, float duration) { float startVolume = cachedVolume; float time = 0f; while (time < duration) { time += Time.deltaTime; float t = time / duration; float newVolume = Mathf.SmoothStep(startVolume, targetVolume, t); SetApplicationVolume(appName, newVolume); yield return null; } SetApplicationVolume(appName, targetVolume); } private static SimpleAudioVolume FindSession(int processId) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) MMDevice defaultAudioEndpoint = new MMDeviceEnumerator().GetDefaultAudioEndpoint((DataFlow)0, (Role)1); SessionCollection sessions = defaultAudioEndpoint.AudioSessionManager.Sessions; for (int i = 0; i < sessions.Count; i++) { if (sessions[i].GetProcessID == processId) { return sessions[i].SimpleAudioVolume; } } return null; } } public static class MediaInfo { } } namespace RumbleMediaControlBinds.ModUISchruff { public class ModUIFunctions { private static Mod Mod = new Mod(); public static bool shouldPauseOnRoundEnd; public static bool shouldResumeOnRoundStart; public static bool turnDownDuringPillarSequence; public static float turnDownVolume = 0.2f; public static float turnUpVolume = 1f; public static string appName = "firefox"; public static void InitModUI() { UI.instance.UI_Initialized += OnUIInit; SetUIOptions(); ReadModUIOptions(); } private static void SetUIOptions() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown Mod.ModName = "Rumble Media Controls"; Mod.ModVersion = "1.0.3"; Mod.SetFolder("RumbleMediaControlls"); Mod.AddToList("Pause on round end", false, 0, "When this is on the music will automatically pause when a round ends", new Tags()); Mod.AddToList("Resume on round start", false, 0, "When this is on the music will automatically resume when a round starts", new Tags()); Mod.AddToList("Turn down during pillar sequence", false, 0, "Turn the music down while the pillar sequence is happening", new Tags()); Mod.AddToList("Turned down audio volume", 0.2f, "Turn the music down while the pillar sequence is happening, it goes from 0.01f to 1.0f", new Tags()); Mod.AddToList("Turned up audio volume", 1f, "Turn the music up when the pillar sequence ends (the default volume you want the music to be at), it goes from 0.01f to 1.0f", new Tags()); Mod.AddToList("Program name", "firefox", "The name of the program you're turning down (case INsensitive) so for example Firefox is 'firefox'", new Tags()); Mod.GetFromFile(); } private static void ReadModUIOptions() { shouldPauseOnRoundEnd = (bool)Mod.Settings[0].SavedValue; shouldResumeOnRoundStart = (bool)Mod.Settings[1].SavedValue; turnDownDuringPillarSequence = (bool)Mod.Settings[2].SavedValue; turnDownVolume = (float)Mod.Settings[3].SavedValue; turnUpVolume = (float)Mod.Settings[4].SavedValue; appName = (string)Mod.Settings[5].SavedValue; } private static void OnUIInit() { Mod.ModSaved += OnUISaved; UI.instance.AddMod(Mod); } private static void OnUISaved() { ReadModUIOptions(); } } }