diff --git a/WorldBoxMod.cs b/WorldBoxMod.cs index 1ee61f05..9beaf4b3 100644 --- a/WorldBoxMod.cs +++ b/WorldBoxMod.cs @@ -114,7 +114,7 @@ private void Update() HarmonyUtils._init(); Harmony.CreateAndPatchAll(typeof(LM), Others.harmony_id); Harmony.CreateAndPatchAll(typeof(ResourcesPatch), Others.harmony_id); - + if (!SmoothLoader.isLoading()) SmoothLoader.prepare(); SmoothLoaderHelper.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 9e3300c5..313ea070 100644 --- a/utils/Sounds/FMODHelpers.cs +++ b/utils/Sounds/FMODHelpers.cs @@ -58,6 +58,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));