SHA256
forked from ADOFAIEditorForum/ADOFAIRenderer
Refactor Every namespace Keyword Usage
This commit is contained in:
1 parent
4e67cb9b09
commit
27be2141f7
44 files changed
+4619
-4545
No files matched your search
@@ -1,21 +1,20 @@
|
||||
using ADOFAIRenderer.Core;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace ADOFAIRenderer.Patch.Engine
|
||||
namespace ADOFAIRenderer.Patch.Engine;
|
||||
|
||||
[HarmonyPatch(typeof(AsyncInputUtils), "UpdateOffsetTime")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static class AsyncInputPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(AsyncInputUtils), "UpdateOffsetTime")]
|
||||
[HarmonyPrefix]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static class AsyncInputPatches
|
||||
public static bool Prefix()
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static bool Prefix()
|
||||
{
|
||||
if (!RenderManager.IsActive) return true;
|
||||
// Force offsetTick to match instantly without 1/100 damping division when rendering
|
||||
AsyncInputManager.offsetTick = AsyncInputManager.currFrameTick - (ulong)(scrConductor.instance.dspTime * 10000000.0);
|
||||
AsyncInputManager.offsetTickUpdated = true;
|
||||
return false; // Skip the original damped offset calculation
|
||||
}
|
||||
if (!RenderManager.IsActive) return true;
|
||||
// Force offsetTick to match instantly without 1/100 damping division when rendering
|
||||
AsyncInputManager.offsetTick = AsyncInputManager.currFrameTick - (ulong)(scrConductor.instance.dspTime * 10000000.0);
|
||||
AsyncInputManager.offsetTickUpdated = true;
|
||||
return false; // Skip the original damped offset calculation
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,110 +4,109 @@ using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
namespace ADOFAIRenderer.Patch.Engine
|
||||
namespace ADOFAIRenderer.Patch.Engine;
|
||||
|
||||
[HarmonyPatch(typeof(AudioManager), "_Play")]
|
||||
public static class AudioManagerPlayPatch
|
||||
{
|
||||
[HarmonyPatch(typeof(AudioManager), "_Play")]
|
||||
public static class AudioManagerPlayPatch
|
||||
[HarmonyPrefix]
|
||||
public static bool Prefix(string snd, double time, AudioMixerGroup group, float volume, int priority)
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
public static bool Prefix(string snd, double time, AudioMixerGroup group, float volume, int priority)
|
||||
if (RenderManager.IsCapturingActive && RenderManager.Instance.Configuration.AudioConfig.RenderAudio)
|
||||
{
|
||||
if (RenderManager.IsCapturingActive && RenderManager.Instance.Configuration.AudioConfig.RenderAudio)
|
||||
// Cache the clip on the main thread
|
||||
RenderManager.Instance.AudioMixer?.CacheClip(snd);
|
||||
}
|
||||
return true; // Let the original method execute to prevent NullReferenceException
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static void Postfix(AudioSource __result, string snd, double time, AudioMixerGroup group, float volume, int priority)
|
||||
{
|
||||
if (RenderManager.IsCapturingActive && RenderManager.Instance.Configuration.AudioConfig.RenderAudio && __result != null)
|
||||
{
|
||||
// Convert absolute DSP time to relative time in seconds from render start
|
||||
double relativeStartTime = time - RenderManager.Instance.dspTimeBase;
|
||||
|
||||
// Register event to the offline mixer (default pitch = 1.0f) and map it to the AudioSource
|
||||
RenderManager.Instance.AudioMixer?.RegisterSoundEvent(__result, snd, relativeStartTime, -1.0, volume, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(scrConductor), "PlayWithEndTime")]
|
||||
public static class PlayWithEndTimePatch
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
public static bool Prefix(string snd, double time, double endTime, float volume, int priority)
|
||||
{
|
||||
if (RenderManager.IsCapturingActive && RenderManager.Instance.Configuration.AudioConfig.RenderAudio)
|
||||
{
|
||||
var mixer = RenderManager.Instance.AudioMixer;
|
||||
if (mixer != null)
|
||||
{
|
||||
// Cache the clip on the main thread
|
||||
RenderManager.Instance.AudioMixer?.CacheClip(snd);
|
||||
}
|
||||
return true; // Let the original method execute to prevent NullReferenceException
|
||||
}
|
||||
mixer.CacheClip(snd);
|
||||
|
||||
[HarmonyPostfix]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static void Postfix(AudioSource __result, string snd, double time, AudioMixerGroup group, float volume, int priority)
|
||||
{
|
||||
if (RenderManager.IsCapturingActive && RenderManager.Instance.Configuration.AudioConfig.RenderAudio && __result != null)
|
||||
{
|
||||
// Convert absolute DSP time to relative time in seconds from render start
|
||||
// Convert absolute DSP times to relative times in seconds from render start
|
||||
double relativeStartTime = time - RenderManager.Instance.dspTimeBase;
|
||||
double relativeEndTime = endTime - RenderManager.Instance.dspTimeBase;
|
||||
|
||||
// Register event to the offline mixer (default pitch = 1.0f) and map it to the AudioSource
|
||||
RenderManager.Instance.AudioMixer?.RegisterSoundEvent(__result, snd, relativeStartTime, -1.0, volume, 1.0f);
|
||||
// Register looping sound event to the offline mixer (default pitch = 1.0f)
|
||||
mixer.RegisterSoundEvent(snd, relativeStartTime, relativeEndTime, volume, 1.0f);
|
||||
}
|
||||
}
|
||||
return true; // Let the original method execute
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(scrConductor), "PlayWithEndTime")]
|
||||
public static class PlayWithEndTimePatch
|
||||
[HarmonyPatch(typeof(AudioSource), "pitch", MethodType.Setter)]
|
||||
public static class AudioSourcePitchPatch
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static void Postfix(AudioSource __instance, float value)
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
public static bool Prefix(string snd, double time, double endTime, float volume, int priority)
|
||||
if (RenderManager.IsCapturingActive && RenderManager.Instance.Configuration.AudioConfig.RenderAudio)
|
||||
{
|
||||
if (RenderManager.IsCapturingActive && RenderManager.Instance.Configuration.AudioConfig.RenderAudio)
|
||||
var mixer = RenderManager.Instance.AudioMixer;
|
||||
if (mixer != null && mixer.TryGetSoundEvent(__instance, out var soundEvent))
|
||||
{
|
||||
var mixer = RenderManager.Instance.AudioMixer;
|
||||
if (mixer != null)
|
||||
{
|
||||
// Cache the clip on the main thread
|
||||
mixer.CacheClip(snd);
|
||||
|
||||
// Convert absolute DSP times to relative times in seconds from render start
|
||||
double relativeStartTime = time - RenderManager.Instance.dspTimeBase;
|
||||
double relativeEndTime = endTime - RenderManager.Instance.dspTimeBase;
|
||||
|
||||
// Register looping sound event to the offline mixer (default pitch = 1.0f)
|
||||
mixer.RegisterSoundEvent(snd, relativeStartTime, relativeEndTime, volume, 1.0f);
|
||||
}
|
||||
}
|
||||
return true; // Let the original method execute
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AudioSource), "pitch", MethodType.Setter)]
|
||||
public static class AudioSourcePitchPatch
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static void Postfix(AudioSource __instance, float value)
|
||||
{
|
||||
if (RenderManager.IsCapturingActive && RenderManager.Instance.Configuration.AudioConfig.RenderAudio)
|
||||
{
|
||||
var mixer = RenderManager.Instance.AudioMixer;
|
||||
if (mixer != null && mixer.TryGetSoundEvent(__instance, out var soundEvent))
|
||||
{
|
||||
soundEvent.Pitch = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AudioSource), "SetScheduledEndTime", typeof(double))]
|
||||
public static class AudioSourceSetScheduledEndTimePatch
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static void Postfix(AudioSource __instance, double time)
|
||||
{
|
||||
if (RenderManager.IsCapturingActive && RenderManager.Instance.Configuration.AudioConfig.RenderAudio)
|
||||
{
|
||||
var mixer = RenderManager.Instance.AudioMixer;
|
||||
if (mixer != null && mixer.TryGetSoundEvent(__instance, out var soundEvent))
|
||||
{
|
||||
soundEvent.EndTime = time - RenderManager.Instance.dspTimeBase;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AudioSource), "Stop", new Type[0])]
|
||||
public static class AudioSourceStopPatch
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static void Postfix(AudioSource __instance)
|
||||
{
|
||||
if (RenderManager.IsCapturingActive && RenderManager.Instance.Configuration.AudioConfig.RenderAudio)
|
||||
{
|
||||
RenderManager.Instance.AudioMixer?.RemoveSourceMapping(__instance);
|
||||
soundEvent.Pitch = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AudioSource), "SetScheduledEndTime", typeof(double))]
|
||||
public static class AudioSourceSetScheduledEndTimePatch
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static void Postfix(AudioSource __instance, double time)
|
||||
{
|
||||
if (RenderManager.IsCapturingActive && RenderManager.Instance.Configuration.AudioConfig.RenderAudio)
|
||||
{
|
||||
var mixer = RenderManager.Instance.AudioMixer;
|
||||
if (mixer != null && mixer.TryGetSoundEvent(__instance, out var soundEvent))
|
||||
{
|
||||
soundEvent.EndTime = time - RenderManager.Instance.dspTimeBase;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AudioSource), "Stop", new Type[0])]
|
||||
public static class AudioSourceStopPatch
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static void Postfix(AudioSource __instance)
|
||||
{
|
||||
if (RenderManager.IsCapturingActive && RenderManager.Instance.Configuration.AudioConfig.RenderAudio)
|
||||
{
|
||||
RenderManager.Instance.AudioMixer?.RemoveSourceMapping(__instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,168 +1,165 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using ADOFAIRenderer.Core;
|
||||
using ADOFAIRenderer.Util;
|
||||
using ADOFAIRenderer.Util.Audio;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ADOFAIRenderer.Patch.Engine
|
||||
namespace ADOFAIRenderer.Patch.Engine;
|
||||
|
||||
public static class RenderEnvironmentPatches
|
||||
{
|
||||
public static class RenderEnvironmentPatches
|
||||
private static double TimeSpent => RenderManager.Instance.frameCount / RenderManager.Instance.Configuration.RenderFPS;
|
||||
|
||||
[HarmonyPatch(typeof(Time), "time", MethodType.Getter)]
|
||||
public static class TimePatch
|
||||
{
|
||||
private const bool RenderPatch = true;
|
||||
private static double TimeSpent => RenderManager.Instance.frameCount / RenderManager.Instance.Configuration.RenderFPS;
|
||||
|
||||
[HarmonyPatch(typeof(Time), "time", MethodType.Getter)]
|
||||
public static class TimePatch
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref float __result)
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref float __result)
|
||||
{
|
||||
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||
__result = (float)(TimeSpent + RenderManager.Instance.timeBase);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Time), "timeAsDouble", MethodType.Getter)]
|
||||
public static class TimeAsDoublePatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref double __result)
|
||||
{
|
||||
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||
__result = TimeSpent + RenderManager.Instance.timeBase;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Time), "unscaledTime", MethodType.Getter)]
|
||||
public static class UnscaledTimePatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref float __result)
|
||||
{
|
||||
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||
__result = (float)(TimeSpent + RenderManager.Instance.unscaledTimeBase);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Time), "unscaledTimeAsDouble", MethodType.Getter)]
|
||||
public static class UnscaledTimeAsDoublePatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref double __result)
|
||||
{
|
||||
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||
__result = TimeSpent + RenderManager.Instance.unscaledTimeBase;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AudioSettings), "dspTime", MethodType.Getter)]
|
||||
public static class DspTimePatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref double __result)
|
||||
{
|
||||
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||
__result = TimeSpent + RenderManager.Instance.dspTimeBase;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AudioSource), "PlayScheduled")]
|
||||
public static class PlayScheduledPatch
|
||||
{
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static bool Prefix(AudioSource __instance, double time)
|
||||
{
|
||||
return !RenderManager.IsActive;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Time), "frameCount", MethodType.Getter)]
|
||||
public static class FrameCountPatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref int __result)
|
||||
{
|
||||
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||
__result = (int)(RenderManager.Instance.frameCount + RenderManager.Instance.frameCountBase);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Time), "deltaTime", MethodType.Getter)]
|
||||
public static class DeltaTimePatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref float __result)
|
||||
{
|
||||
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||
__result = (float)(1 / RenderManager.Instance.Configuration.RenderFPS);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Time), "unscaledDeltaTime", MethodType.Getter)]
|
||||
public static class UnscaledDeltaTimePatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref float __result)
|
||||
{
|
||||
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||
__result = (float)(1 / RenderManager.Instance.Configuration.RenderFPS);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Screen), "width", MethodType.Getter)]
|
||||
public static class ScreenWidthPatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref int __result)
|
||||
{
|
||||
if (!RenderManager.IsActive || !RenderContext.ScreenPatch || !RenderManager.Instance) return true;
|
||||
__result = RenderManager.Instance.Configuration.RenderWidth;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Screen), "height", MethodType.Getter)]
|
||||
public static class ScreenHeightPatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref int __result)
|
||||
{
|
||||
if (!RenderManager.IsActive || !RenderContext.ScreenPatch || !RenderManager.Instance) return true;
|
||||
__result = RenderManager.Instance.Configuration.RenderHeight;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AudioSource), "GetSpectrumData", typeof(float[]), typeof(int), typeof(FFTWindow))]
|
||||
public static class GetSpectrumDataPatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(AudioSource __instance, float[] samples, int channel, FFTWindow window)
|
||||
{
|
||||
if (!RenderManager.IsCapturingActive || !RenderManager.Instance.Configuration.AdvancedConfig.ProcessAudio) return true;
|
||||
AudioSpectrumGenerator.GetSpectrumData(samples, channel, window);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AudioManager), "FindOrLoadAudioClipExternal", typeof(string), typeof(bool), typeof(float), typeof(bool))]
|
||||
public static class FindOrLoadAudioClipExternalPatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static void Prefix(ref bool stream)
|
||||
{
|
||||
if (RenderManager.Instance && RenderManager.Instance.OverrideLoading && RenderManager.Instance.Configuration.AdvancedConfig.ProcessAudio)
|
||||
stream = false;
|
||||
}
|
||||
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||
__result = (float)(TimeSpent + RenderManager.Instance.timeBase);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Time), "timeAsDouble", MethodType.Getter)]
|
||||
public static class TimeAsDoublePatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref double __result)
|
||||
{
|
||||
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||
__result = TimeSpent + RenderManager.Instance.timeBase;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Time), "unscaledTime", MethodType.Getter)]
|
||||
public static class UnscaledTimePatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref float __result)
|
||||
{
|
||||
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||
__result = (float)(TimeSpent + RenderManager.Instance.unscaledTimeBase);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Time), "unscaledTimeAsDouble", MethodType.Getter)]
|
||||
public static class UnscaledTimeAsDoublePatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref double __result)
|
||||
{
|
||||
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||
__result = TimeSpent + RenderManager.Instance.unscaledTimeBase;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AudioSettings), "dspTime", MethodType.Getter)]
|
||||
public static class DspTimePatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref double __result)
|
||||
{
|
||||
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||
__result = TimeSpent + RenderManager.Instance.dspTimeBase;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AudioSource), "PlayScheduled")]
|
||||
public static class PlayScheduledPatch
|
||||
{
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static bool Prefix(AudioSource __instance, double time)
|
||||
{
|
||||
return !RenderManager.IsActive;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Time), "frameCount", MethodType.Getter)]
|
||||
public static class FrameCountPatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref int __result)
|
||||
{
|
||||
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||
__result = (int)(RenderManager.Instance.frameCount + RenderManager.Instance.frameCountBase);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Time), "deltaTime", MethodType.Getter)]
|
||||
public static class DeltaTimePatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref float __result)
|
||||
{
|
||||
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||
__result = (float)(1 / RenderManager.Instance.Configuration.RenderFPS);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Time), "unscaledDeltaTime", MethodType.Getter)]
|
||||
public static class UnscaledDeltaTimePatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref float __result)
|
||||
{
|
||||
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||
__result = (float)(1 / RenderManager.Instance.Configuration.RenderFPS);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Screen), "width", MethodType.Getter)]
|
||||
public static class ScreenWidthPatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref int __result)
|
||||
{
|
||||
if (!RenderManager.IsActive || !RenderContext.ScreenPatch || !RenderManager.Instance) return true;
|
||||
__result = RenderManager.Instance.Configuration.RenderWidth;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Screen), "height", MethodType.Getter)]
|
||||
public static class ScreenHeightPatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(ref int __result)
|
||||
{
|
||||
if (!RenderManager.IsActive || !RenderContext.ScreenPatch || !RenderManager.Instance) return true;
|
||||
__result = RenderManager.Instance.Configuration.RenderHeight;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AudioSource), "GetSpectrumData", typeof(float[]), typeof(int), typeof(FFTWindow))]
|
||||
public static class GetSpectrumDataPatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool Prefix(AudioSource __instance, float[] samples, int channel, FFTWindow window)
|
||||
{
|
||||
if (!RenderManager.IsCapturingActive || !RenderManager.Instance.Configuration.AdvancedConfig.ProcessAudio) return true;
|
||||
AudioSpectrumGenerator.GetSpectrumData(samples, channel, window);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AudioManager), "FindOrLoadAudioClipExternal", typeof(string), typeof(bool), typeof(float), typeof(bool))]
|
||||
public static class FindOrLoadAudioClipExternalPatch
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static void Prefix(ref bool stream)
|
||||
{
|
||||
if (RenderManager.Instance && RenderManager.Instance.OverrideLoading && RenderManager.Instance.Configuration.AdvancedConfig.ProcessAudio)
|
||||
stream = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user