SHA256
Add RenderContext
This commit is contained in:
2 files changed
+22
-14
No files matched your search
+12
-4
@@ -21,11 +21,19 @@ using ThreadPriority = System.Threading.ThreadPriority;
|
|||||||
|
|
||||||
namespace ADOFAIRenderer.Core
|
namespace ADOFAIRenderer.Core
|
||||||
{
|
{
|
||||||
internal static class RenderFlags
|
internal static class RenderContext
|
||||||
{
|
{
|
||||||
public static bool Auto = true;
|
public static bool Auto = true;
|
||||||
public static bool TimePatch = true;
|
public static bool TimePatch = true;
|
||||||
public static bool ScreenPatch = 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
|
internal class RenderManager : MonoBehaviour
|
||||||
@@ -201,7 +209,7 @@ namespace ADOFAIRenderer.Core
|
|||||||
_originalInputOffset = scrConductor.currentPreset.inputOffset;
|
_originalInputOffset = scrConductor.currentPreset.inputOffset;
|
||||||
scrConductor.currentPreset.inputOffset = 0;
|
scrConductor.currentPreset.inputOffset = 0;
|
||||||
|
|
||||||
RDC.auto = RenderFlags.Auto;
|
RDC.auto = RenderContext.Auto;
|
||||||
AccessTools.Field(typeof(scrController), "disableCongratsMessage")
|
AccessTools.Field(typeof(scrController), "disableCongratsMessage")
|
||||||
.SetValue(scrController.instance, true);
|
.SetValue(scrController.instance, true);
|
||||||
|
|
||||||
@@ -233,14 +241,14 @@ namespace ADOFAIRenderer.Core
|
|||||||
StopFFmpeg(false);
|
StopFFmpeg(false);
|
||||||
EndRender();
|
EndRender();
|
||||||
}
|
}
|
||||||
else if (scrController.instance.state == States.Won)
|
else if (RenderContext.EndCondition())
|
||||||
{
|
{
|
||||||
if (wonFrame == -1)
|
if (wonFrame == -1)
|
||||||
{
|
{
|
||||||
wonFrame = frameCount;
|
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;
|
if (frameCount - wonFrame < extraFrames) return;
|
||||||
ResetRenderState(success: true);
|
ResetRenderState(success: true);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace ADOFAIRenderer.Patch.Engine
|
|||||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
public static bool Prefix(ref float __result)
|
public static bool Prefix(ref float __result)
|
||||||
{
|
{
|
||||||
if (!RenderManager.IsCapturingActive || !RenderFlags.TimePatch) return true;
|
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||||
__result = (float)(TimeSpent + RenderManager.Instance.timeBase);
|
__result = (float)(TimeSpent + RenderManager.Instance.timeBase);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ namespace ADOFAIRenderer.Patch.Engine
|
|||||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
public static bool Prefix(ref double __result)
|
public static bool Prefix(ref double __result)
|
||||||
{
|
{
|
||||||
if (!RenderManager.IsCapturingActive || !RenderFlags.TimePatch) return true;
|
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||||
__result = TimeSpent + RenderManager.Instance.timeBase;
|
__result = TimeSpent + RenderManager.Instance.timeBase;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ namespace ADOFAIRenderer.Patch.Engine
|
|||||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
public static bool Prefix(ref float __result)
|
public static bool Prefix(ref float __result)
|
||||||
{
|
{
|
||||||
if (!RenderManager.IsCapturingActive || !RenderFlags.TimePatch) return true;
|
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||||
__result = (float)(TimeSpent + RenderManager.Instance.unscaledTimeBase);
|
__result = (float)(TimeSpent + RenderManager.Instance.unscaledTimeBase);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ namespace ADOFAIRenderer.Patch.Engine
|
|||||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
public static bool Prefix(ref double __result)
|
public static bool Prefix(ref double __result)
|
||||||
{
|
{
|
||||||
if (!RenderManager.IsCapturingActive || !RenderFlags.TimePatch) return true;
|
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||||
__result = TimeSpent + RenderManager.Instance.unscaledTimeBase;
|
__result = TimeSpent + RenderManager.Instance.unscaledTimeBase;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ namespace ADOFAIRenderer.Patch.Engine
|
|||||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
public static bool Prefix(ref double __result)
|
public static bool Prefix(ref double __result)
|
||||||
{
|
{
|
||||||
if (!RenderManager.IsCapturingActive || !RenderFlags.TimePatch) return true;
|
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||||
__result = TimeSpent + RenderManager.Instance.dspTimeBase;
|
__result = TimeSpent + RenderManager.Instance.dspTimeBase;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ namespace ADOFAIRenderer.Patch.Engine
|
|||||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
public static bool Prefix(ref int __result)
|
public static bool Prefix(ref int __result)
|
||||||
{
|
{
|
||||||
if (!RenderManager.IsCapturingActive || !RenderFlags.TimePatch) return true;
|
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||||
__result = (int)(RenderManager.Instance.frameCount + RenderManager.Instance.frameCountBase);
|
__result = (int)(RenderManager.Instance.frameCount + RenderManager.Instance.frameCountBase);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ namespace ADOFAIRenderer.Patch.Engine
|
|||||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
public static bool Prefix(ref float __result)
|
public static bool Prefix(ref float __result)
|
||||||
{
|
{
|
||||||
if (!RenderManager.IsCapturingActive || !RenderFlags.TimePatch) return true;
|
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||||
__result = (float)(1 / RenderManager.Instance.Configuration.RenderFPS);
|
__result = (float)(1 / RenderManager.Instance.Configuration.RenderFPS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ namespace ADOFAIRenderer.Patch.Engine
|
|||||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
public static bool Prefix(ref float __result)
|
public static bool Prefix(ref float __result)
|
||||||
{
|
{
|
||||||
if (!RenderManager.IsCapturingActive || !RenderFlags.TimePatch) return true;
|
if (!RenderManager.IsCapturingActive || !RenderContext.TimePatch) return true;
|
||||||
__result = (float)(1 / RenderManager.Instance.Configuration.RenderFPS);
|
__result = (float)(1 / RenderManager.Instance.Configuration.RenderFPS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ namespace ADOFAIRenderer.Patch.Engine
|
|||||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
public static bool Prefix(ref int __result)
|
public static bool Prefix(ref int __result)
|
||||||
{
|
{
|
||||||
if (!RenderManager.IsActive || !RenderFlags.ScreenPatch || !RenderManager.Instance) return true;
|
if (!RenderManager.IsActive || !RenderContext.ScreenPatch || !RenderManager.Instance) return true;
|
||||||
__result = RenderManager.Instance.Configuration.RenderWidth;
|
__result = RenderManager.Instance.Configuration.RenderWidth;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,7 @@ namespace ADOFAIRenderer.Patch.Engine
|
|||||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
public static bool Prefix(ref int __result)
|
public static bool Prefix(ref int __result)
|
||||||
{
|
{
|
||||||
if (!RenderManager.IsActive || !RenderFlags.ScreenPatch || !RenderManager.Instance) return true;
|
if (!RenderManager.IsActive || !RenderContext.ScreenPatch || !RenderManager.Instance) return true;
|
||||||
__result = RenderManager.Instance.Configuration.RenderHeight;
|
__result = RenderManager.Instance.Configuration.RenderHeight;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user