From 9e193d1d8f62ba22278f8cc005a9000fff47a79e Mon Sep 17 00:00:00 2001 From: "Melvin \"Dumbass\" Shwuaner" <83349478+MelvinShwuaner@users.noreply.github.com> Date: Mon, 11 May 2026 10:05:02 +0300 Subject: [PATCH] yes --- WorldBoxMod.cs | 1 - services/DebugService.cs | 45 +++++++++++++++++++++++++++++++++++++ utils/Sounds/FMODHelpers.cs | 3 +++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 services/DebugService.cs diff --git a/WorldBoxMod.cs b/WorldBoxMod.cs index 888975fe..e3227efd 100644 --- a/WorldBoxMod.cs +++ b/WorldBoxMod.cs @@ -102,7 +102,6 @@ private void Update() HarmonyUtils._init(); Harmony.CreateAndPatchAll(typeof(LM), Others.harmony_id); Harmony.CreateAndPatchAll(typeof(ResourcesPatch), Others.harmony_id); - Harmony.CreateAndPatchAll(typeof(FMODPatches), Others.harmony_id); if (!SmoothLoader.isLoading()) SmoothLoader.prepare(); SmoothLoader.add(() => diff --git a/services/DebugService.cs b/services/DebugService.cs new file mode 100644 index 00000000..6855e4ec --- /dev/null +++ b/services/DebugService.cs @@ -0,0 +1,45 @@ +using System.Reflection; +using HarmonyLib; +using NeoModLoader.constants; + +namespace NeoModLoader.services; + +public static class DebugService +{ + static void Debugger(MethodBase __originalMethod) + { + LogService.LogInfo(__originalMethod.ToString()); + } + static readonly Harmony Patcher = new Harmony(Others.harmony_id); + private static readonly HarmonyMethod Hook = new(AccessTools.Method(typeof(DebugService), nameof(Debugger))); + public static void AttachDebugger(Assembly assembly) + { + foreach (var Type in assembly.GetTypes()) + { + foreach (var method in Type.GetMethods( + BindingFlags.Public | + BindingFlags.NonPublic | + BindingFlags.Instance | + BindingFlags.Static | + BindingFlags.DeclaredOnly)) + { + Patcher.Patch(method, Hook); + } + } + } + public static void RemoveDebugger(Assembly assembly) + { + foreach (var Type in assembly.GetTypes()) + { + foreach (var method in Type.GetMethods( + BindingFlags.Public | + BindingFlags.NonPublic | + BindingFlags.Instance | + BindingFlags.Static | + BindingFlags.DeclaredOnly)) + { + Patcher.Unpatch(method, HarmonyPatchType.Prefix); + } + } + } +} \ No newline at end of file diff --git a/utils/Sounds/FMODHelpers.cs b/utils/Sounds/FMODHelpers.cs index 67bc5e36..b6811494 100644 --- a/utils/Sounds/FMODHelpers.cs +++ b/utils/Sounds/FMODHelpers.cs @@ -1,6 +1,7 @@ using FMOD; using FMODUnity; using HarmonyLib; +using NeoModLoader.constants; using UnityEngine; namespace NeoModLoader.utils.Sounds; @@ -51,6 +52,7 @@ static void ClearAllCustomSounds() [HarmonyPatch(typeof(RuntimeManager), "Update")] static void Update() { + SFXGroup.setVolume(GetVolume(SoundType.Sound)); MusicGroup.setVolume(GetVolume(SoundType.Music)); UIGroup.setVolume(GetVolume(SoundType.UI)); @@ -69,6 +71,7 @@ public static class FMODHelper internal static void InitFMOD() { + Harmony.CreateAndPatchAll(typeof(FMODPatches), Others.harmony_id); ThrowIfNotOk("Failed to initialize FMOD Core System!", RuntimeManager.StudioSystem.getCoreSystem(out var coresystem)); FMODSystem = coresystem; ThrowIfNotOk("Failed to create SFXGroup", FMODSystem.createChannelGroup("SFXGroup", out var Group));