Improve Support for Floating-point FPS

This commit is contained in:
copecone committed 2026-05-25 17:00:44 +09:00
1 parent b10f72b529
commit 5ee4a7fc51
3 files changed
+18 -14

No files matched your search

+10 -8
View File
@@ -95,14 +95,15 @@ namespace ADOFAIRenderer
// 60회 초과 시 최후의 블랙 프레임 삽입하여 전체 파이프라인 마비 방지
Melon<RenderMod>.Logger.Error($"[Render Skipped] Frame {RenderManager.FrameCount} rendering failed after 60 retries. Supplying black frame.");
var targetFps = (int)RenderManager.Configuration.TargetFPS;
var videoFps = (int)RenderManager.Configuration.VideoFPS;
var num = targetFps % videoFps != 0 ? 1 : targetFps / videoFps;
var targetFps = RenderManager.Configuration.TargetFPS;
var videoFps = RenderManager.Configuration.VideoFPS;
var quotient = targetFps / videoFps;
var num = Math.Abs(quotient - Math.Round(quotient)) < 1e-9 ? (int)Math.Round(quotient) : 1;
if (FrameCountForVideo % num == 0)
{
int byteSize = RenderManager.Configuration.RenderWidth * RenderManager.Configuration.RenderHeight * 4;
byte[] blackFrame = System.Buffers.ArrayPool<byte>.Shared.Rent(byteSize);
var byteSize = RenderManager.Configuration.RenderWidth * RenderManager.Configuration.RenderHeight * 4;
var blackFrame = System.Buffers.ArrayPool<byte>.Shared.Rent(byteSize);
Array.Clear(blackFrame, 0, byteSize);
lock (RenderManager.ImageQueue)
@@ -119,10 +120,10 @@ namespace ADOFAIRenderer
RenderCheck = true; // 다음 프레임 검사용으로 초기화
RenderManager.FrameCount++;
if (realDeltaTime > 0)
/*if (realDeltaTime > 0)
{
Time.timeScale = (float)(Time.deltaTime / realDeltaTime);
}
}*/
}
public static int FrameCountForVideo;
@@ -163,7 +164,8 @@ namespace ADOFAIRenderer
var targetFps = RenderManager.Configuration.TargetFPS;
var videoFps = RenderManager.Configuration.VideoFPS;
var num = targetFps % videoFps != 0.0 ? 1 : (int)(targetFps / videoFps);
var quotient = targetFps / videoFps;
var num = Math.Abs(quotient - Math.Round(quotient)) < 1e-9 ? (int)Math.Round(quotient) : 1;
if (currentFrame % num != 0)
{