1
0

3DSoundPatches.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using Il2Cpp;
  2. using MelonLoader;
  3. using UnityEngine;
  4. namespace AudioMgr
  5. {
  6. [HarmonyLib.HarmonyPatch(typeof(GameAudioManager), "Play3DSound", new Type[] { typeof(string), typeof(GameObject)})]
  7. public class Play3DSoundPatchString
  8. {
  9. public static bool Prefix(ref GameAudioManager __instance, ref string soundID, ref GameObject go)
  10. {
  11. if(AudioMain._debug)
  12. MelonLogger.Msg("Play3D string " + soundID + " on " + go.name);
  13. if (PatchMaster.PatchAction(soundID, go))
  14. {
  15. return false;
  16. }
  17. return true;
  18. }
  19. }
  20. [HarmonyLib.HarmonyPatch(typeof(GameAudioManager), "Play3DSound", new Type[] { typeof(uint), typeof(GameObject) })]
  21. public class Play3DSoundPatchUInt
  22. {
  23. public static bool Prefix(ref GameAudioManager __instance, ref uint soundID, ref GameObject go)
  24. {
  25. if (AudioMain._debug)
  26. MelonLogger.Msg("Play3D uint " + EventIDs.GetEventString(soundID) + " on " + go.name);
  27. if (PatchMaster.PatchAction(EventIDs.GetEventString(soundID), go))
  28. {
  29. return false;
  30. }
  31. return true;
  32. }
  33. }
  34. [HarmonyLib.HarmonyPatch(typeof(GameAudioManager), "Play3DSound", new Type[] { typeof(Il2CppAK.Wwise.Event), typeof(GameObject) })]
  35. public class Play3DSoundPatchEvent
  36. {
  37. public static void Prefix(ref GameAudioManager __instance, ref Il2CppAK.Wwise.Event soundEvent, ref GameObject go)
  38. {
  39. if (AudioMain._debug)
  40. MelonLogger.Msg("Play3D event " + soundEvent.Name + " on " + go.name);
  41. }
  42. }
  43. }