1
0

RTPCPatches.cs 1.0 KB

1234567891011121314151617181920212223242526272829
  1. using Il2Cpp;
  2. using Il2CppAudio.SimpleAudio;
  3. using MelonLoader;
  4. using UnityEngine;
  5. namespace AudioMgr
  6. {
  7. [HarmonyLib.HarmonyPatch(typeof(GameAudioManager), "SetRTPCValue", new Type[] { typeof(uint), typeof(float), typeof(GameObject) })]
  8. public class RTPCPatches
  9. {
  10. public static void Prefix(GameAudioManager __instance, ref uint rtpcID, ref float rtpcValue, ref GameObject go)
  11. {
  12. // GAME_PARAMETERS
  13. //MelonLogger.Msg("RTPC " + GameParameterIDs.GetString(rtpcID) + "; " + rtpcValue);
  14. if (VolumeIDs.GetRtpcIDMaster() == rtpcID)
  15. {
  16. VolumeMaster.SetMasterVolume(rtpcValue / 100);
  17. }
  18. else if (VolumeIDs.GetRtpcIDList().ContainsKey(rtpcID)) // Set sfx/voice/ambient/bgm
  19. {
  20. VolumeMaster.SetVolume(VolumeIDs.GetRtpcIDList()[rtpcID], rtpcValue / 100);
  21. }
  22. rtpcValue = PatchMaster.ParameterAction(GameParameterIDs.GetString(rtpcID), rtpcValue);
  23. }
  24. }
  25. }