Please disclose if any significant portion of your mod was created 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 REPOpad v3.10.6
REPOpad.dll
Decompiled 17 hours agousing System; 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 BepInEx.Configuration; using BepInEx.Logging; using Photon.Voice.Unity; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("R.E.P.O.pad")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("R.E.P.O.pad")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("1950e5d2-7bce-414a-9e82-81c09d27e76c")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace REPOpad; [BepInPlugin("com.renat.customsoundboard", "REPOpad", "3.10.6")] public class SoundboardPlugin : BaseUnityPlugin { public static SoundboardPlugin Instance; public static ManualLogSource Log; public ConfigEntry<KeyCode> openMenuKey; public ConfigEntry<KeyCode> stopSoundKey; public string soundsDirectory; private static bool managerCreated; private void Awake() { Instance = this; Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"R.E.P.O. Custom Soundboard v1.0.1 initializing..."); soundsDirectory = Path.Combine(Paths.PluginPath, "CustomSoundboard", "Sounds"); if (!Directory.Exists(soundsDirectory)) { Directory.CreateDirectory(soundsDirectory); } openMenuKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("UI Settings", "Open Menu Key", (KeyCode)287, "Hotkey to open/close the soundboard menu"); stopSoundKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("UI Settings", "Stop Sound Key", (KeyCode)0, "Hotkey to force stop the currently playing sound"); SceneManager.sceneLoaded += OnSceneLoaded; Log.LogInfo((object)"R.E.P.O. Custom Soundboard core initialized successfully!"); } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown if (!managerCreated) { GameObject val = new GameObject("R.E.P.O.SoundboardManager"); Object.DontDestroyOnLoad((Object)val); val.AddComponent<SoundboardManager>(); managerCreated = true; Log.LogInfo((object)"SoundboardManager successfully spawned in active scene context!"); } } } public class SoundboardManager : MonoBehaviour { private class SoundTrack { public string FileName { get; set; } public string FilePath { get; set; } public KeyCode Key { get; set; } public AudioClip Clip { get; set; } } private bool showMenu; private List<SoundTrack> tracks = new List<SoundTrack>(); private AudioSource audioSource; private SoundTrack bindingTrack; private Recorder cachedRecorder; private void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown GameObject val = new GameObject("R.E.P.O.AudioSource"); audioSource = val.AddComponent<AudioSource>(); Object.DontDestroyOnLoad((Object)(object)val); ReloadSoundsFolder(); } public void ReloadSoundsFolder() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) tracks.Clear(); string soundsDirectory = SoundboardPlugin.Instance.soundsDirectory; if (!Directory.Exists(soundsDirectory)) { return; } string[] files = Directory.GetFiles(soundsDirectory, "*.wav"); int num = 0; string[] array = files; foreach (string text in array) { AudioClip val = LoadWav(text); if ((Object)(object)val != (Object)null) { KeyCode key = (KeyCode)0; switch (num) { case 0: key = (KeyCode)257; break; case 1: key = (KeyCode)258; break; case 2: key = (KeyCode)259; break; case 3: key = (KeyCode)260; break; case 4: key = (KeyCode)261; break; } tracks.Add(new SoundTrack { FileName = Path.GetFileName(text), FilePath = text, Key = key, Clip = val }); num++; } } SoundboardPlugin.Log.LogInfo((object)$"Loaded {tracks.Count} sound tracks."); } private AudioClip LoadWav(string filePath) { try { byte[] array = File.ReadAllBytes(filePath); int num = BitConverter.ToInt16(array, 22); int num2 = BitConverter.ToInt32(array, 24); int num3 = BitConverter.ToInt16(array, 34); int i; for (i = 12; i < array.Length - 8; i++) { if (array[i] == 100 && array[i + 1] == 97 && array[i + 2] == 116 && array[i + 3] == 97) { i += 8; break; } } int num4 = array.Length - i; int num5 = num3 / 8; if (num5 == 0) { num5 = 2; } int num6 = num4 / num5; int num7 = num6 / num; float[] array2 = new float[num6]; int num8 = ((num3 == 8) ? 128 : 32767); int num9 = i; for (int j = 0; j < num6; j++) { if (num9 + num5 > array.Length) { break; } short num10 = BitConverter.ToInt16(array, num9); array2[j] = (float)num10 / (float)num8; num9 += num5; } AudioClip obj = AudioClip.Create(Path.GetFileName(filePath), num7, num, num2, false); obj.SetData(array2, 0); return obj; } catch (Exception ex) { SoundboardPlugin.Log.LogError((object)("Error loading WAV file: " + ex.Message)); return null; } } private void PlayTrack(SoundTrack track) { if (!((Object)(object)audioSource == (Object)null) && !((Object)(object)track.Clip == (Object)null)) { audioSource.Stop(); audioSource.clip = track.Clip; audioSource.Play(); SoundboardPlugin.Log.LogInfo((object)("Playing track: " + track.FileName)); if ((Object)(object)cachedRecorder == (Object)null) { cachedRecorder = Object.FindObjectOfType<Recorder>(); } if ((Object)(object)cachedRecorder != (Object)null) { cachedRecorder.SourceType = (InputSourceType)1; cachedRecorder.AudioClip = track.Clip; cachedRecorder.TransmitEnabled = true; ((MonoBehaviour)this).CancelInvoke("RestoreMicrophone"); ((MonoBehaviour)this).Invoke("RestoreMicrophone", track.Clip.length + 0.1f); } } } private void StopCurrentSound() { if ((Object)(object)audioSource != (Object)null && audioSource.isPlaying) { audioSource.Stop(); ((MonoBehaviour)this).CancelInvoke("RestoreMicrophone"); RestoreMicrophone(); SoundboardPlugin.Log.LogInfo((object)"Sound stopped manually by hotkey."); } } private void RestoreMicrophone() { if ((Object)(object)cachedRecorder != (Object)null) { cachedRecorder.SourceType = (InputSourceType)0; cachedRecorder.AudioClip = null; } } private void Update() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_005a: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Invalid comparison between Unknown and I4 //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) int num = ((SoundboardPlugin.Instance.openMenuKey == null) ? 287 : ((int)SoundboardPlugin.Instance.openMenuKey.Value)); KeyCode val = (KeyCode)((SoundboardPlugin.Instance.stopSoundKey != null) ? ((int)SoundboardPlugin.Instance.stopSoundKey.Value) : 0); if (Input.GetKeyDown((KeyCode)num)) { showMenu = !showMenu; } if ((int)val != 0 && Input.GetKeyDown(val)) { StopCurrentSound(); } if (bindingTrack != null && Input.anyKeyDown) { foreach (KeyCode value in Enum.GetValues(typeof(KeyCode))) { if (Input.GetKeyDown(value)) { if ((int)value != 27) { bindingTrack.Key = value; } bindingTrack = null; break; } } } if (showMenu || bindingTrack != null) { return; } foreach (SoundTrack track in tracks) { if ((int)track.Key != 0 && Input.GetKeyDown(track.Key)) { PlayTrack(track); } } } private void OnGUI() { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) if (!showMenu) { return; } KeyCode val = (KeyCode)((SoundboardPlugin.Instance.openMenuKey == null) ? 287 : ((int)SoundboardPlugin.Instance.openMenuKey.Value)); GUI.Box(new Rect((float)(Screen.width / 2 - 250), (float)(Screen.height / 2 - 220), 500f, 440f), "R.E.P.O. SOUNDBOARD"); float num = Screen.height / 2 - 170; if (GUI.Button(new Rect((float)(Screen.width / 2 - 230), num, 225f, 35f), "OPEN SOUNDS FOLDER")) { try { Process.Start("explorer.exe", SoundboardPlugin.Instance.soundsDirectory); } catch { } } if (GUI.Button(new Rect((float)(Screen.width / 2 + 5), num, 225f, 35f), "RELOAD SOUNDS")) { ReloadSoundsFolder(); } num += 45f; for (int i = 0; i < tracks.Count; i++) { SoundTrack soundTrack = tracks[i]; GUI.Label(new Rect((float)(Screen.width / 2 - 230), num + (float)(i * 40), 280f, 30f), $"{i + 1}. {soundTrack.FileName}"); string text = ((bindingTrack == soundTrack) ? "PRESS ANY KEY..." : $"[{soundTrack.Key}]"); if (GUI.Button(new Rect((float)(Screen.width / 2 + 60), num + (float)(i * 40), 170f, 30f), text)) { bindingTrack = soundTrack; } } GUI.Label(new Rect((float)(Screen.width / 2 - 230), num + 320f, 460f, 30f), $"Press [{val}] to close. Click hotkey box to rebind."); } }