diff --git a/Component/RenderManager.cs b/Component/RenderManager.cs index 764e422..e052015 100644 --- a/Component/RenderManager.cs +++ b/Component/RenderManager.cs @@ -50,9 +50,9 @@ namespace ADOFAIRenderer.Component public static SortedList ImageQueue = new SortedList(); public static Thread? RenderThread; - public static int PassCount = 0; - public static bool EndRequested = false; - public static bool EndSuccessful = false; + public static int PassCount; + public static bool EndRequested; + public static bool EndSuccessful; public static int WonFrame = -1; private static bool _renderSetup; @@ -219,7 +219,7 @@ namespace ADOFAIRenderer.Component float bitrate = Configuration.Bitrate; var codecStr = Configuration.Codec; - VideoFFmpeg.Codec selectedCodec = VideoFFmpeg.Codec.H264_Default; + var selectedCodec = VideoFFmpeg.Codec.H264_Default; if (Enum.TryParse(codecStr, true, out var parsedCodec)) { selectedCodec = parsedCodec; @@ -320,7 +320,7 @@ namespace ADOFAIRenderer.Component Destroy(_debugMonitorObj); _debugMonitorObj = null; } - if (RenderThread != null && RenderThread.IsAlive) + if (RenderThread is { IsAlive: true }) { RenderThread.Join(2000); } diff --git a/Patch/ClassPatch/scrUIControllerPatch.cs b/Patch/ClassPatch/scrUIControllerPatch.cs index a94a248..8e17fb9 100644 --- a/Patch/ClassPatch/scrUIControllerPatch.cs +++ b/Patch/ClassPatch/scrUIControllerPatch.cs @@ -8,6 +8,7 @@ namespace ADOFAIRenderer.Patch.ClassPatch { [HarmonyPostfix] [HarmonyPatch("ShowEndscreenLanterns")] + // ReSharper disable once InconsistentNaming public static void PreventEndscreenLanternsPostfix(scrUIController __instance) { if (RenderMod.IsRendering && __instance != null) diff --git a/RenderMod.cs b/RenderMod.cs index a3f8bbe..3a4e5bc 100644 --- a/RenderMod.cs +++ b/RenderMod.cs @@ -17,6 +17,11 @@ namespace ADOFAIRenderer public class RenderMod : MelonMod { + static RenderMod() + { + ThrottleCount = 0; + } + public static AssetBundle FontBundle = null!; // ReSharper disable once MemberCanBePrivate.Global public static AssetBundle SceneBundle = null!; @@ -120,10 +125,10 @@ namespace ADOFAIRenderer } } - public static int FrameCountForVideo = 0; - public static int ReadbackFailureCount = 0; - public static int ThrottleCount = 0; - public static bool IsThrottling = false; + public static int FrameCountForVideo; + public static int ReadbackFailureCount; + public static int ThrottleCount; + public static bool IsThrottling; public static void OnPostRender(RenderTexture? texture) {