Add RenderContext

This commit is contained in:
copecone committed 2026-08-17 21:15:54 +09:00
1 parent 5316840811
commit e210da9bb0
2 files changed
+22 -14

No files matched your search

+12 -4
View File
@@ -21,11 +21,19 @@ using ThreadPriority = System.Threading.ThreadPriority;
namespace ADOFAIRenderer.Core
{
internal static class RenderFlags
internal static class RenderContext
{
public static bool Auto = true;
public static bool TimePatch = true;
public static bool ScreenPatch = true;
public static Func<bool> EndCondition = () => scrController.instance.state == States.Won;
public static void Reset()
{
Auto = true;
TimePatch = true; ScreenPatch = true;
EndCondition = () => scrController.instance.state == States.Won;
}
}
internal class RenderManager : MonoBehaviour
@@ -201,7 +209,7 @@ namespace ADOFAIRenderer.Core
_originalInputOffset = scrConductor.currentPreset.inputOffset;
scrConductor.currentPreset.inputOffset = 0;
RDC.auto = RenderFlags.Auto;
RDC.auto = RenderContext.Auto;
AccessTools.Field(typeof(scrController), "disableCongratsMessage")
.SetValue(scrController.instance, true);
@@ -233,14 +241,14 @@ namespace ADOFAIRenderer.Core
StopFFmpeg(false);
EndRender();
}
else if (scrController.instance.state == States.Won)
else if (RenderContext.EndCondition())
{
if (wonFrame == -1)
{
wonFrame = frameCount;
}
var extraFrames = (long)Math.Ceiling(Configuration.DelayAfterLevelEnd * Configuration.RenderFPS);
var extraFrames = (long)Math.Ceiling(Configuration.DelayAfterEnd * Configuration.RenderFPS);
if (frameCount - wonFrame < extraFrames) return;
ResetRenderState(success: true);