SHA256
Add Basic Reworked UI
This commit is contained in:
13 files changed
+218
-406
No files matched your search
+22
-65
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Buffers;
|
||||
using ADOFAIRenderer.Data;
|
||||
using ADOFAIRenderer.UI;
|
||||
using ADOFAIRenderer.Util;
|
||||
using ADOFAIRenderer.Util.FFmpeg;
|
||||
@@ -31,7 +32,7 @@ namespace ADOFAIRenderer.Core
|
||||
public bool skipPressToStart;
|
||||
public string levelPath = "";
|
||||
public bool isRenderCancelled;
|
||||
public RenderSettings Configuration;
|
||||
public RenderConfig Configuration = null!;
|
||||
|
||||
// Render Sessions State (OOP Instance Fields)
|
||||
public bool isRendering;
|
||||
@@ -52,47 +53,6 @@ namespace ADOFAIRenderer.Core
|
||||
public int throttleCount;
|
||||
public bool isThrottling;
|
||||
|
||||
public struct RenderSettings
|
||||
{
|
||||
public double TargetFPS;
|
||||
public double VideoFPS;
|
||||
|
||||
public int RenderWidth;
|
||||
public int RenderHeight;
|
||||
|
||||
public RateControlMode BitrateMode;
|
||||
public int Bitrate;
|
||||
public int MaxBitrate;
|
||||
public int QP;
|
||||
|
||||
public string Codec;
|
||||
public double EndWaitTime;
|
||||
public bool ShowHitText;
|
||||
public int? RandomSeed;
|
||||
|
||||
public RenderSettings(double targetFPS, double videoFPS, int renderWidth, int renderHeight,
|
||||
RateControlMode bitrateMode, int bitrate, int maxBitrate, int qp,
|
||||
string codec, double endWaitTime, bool showHitText, int? randomSeed)
|
||||
{
|
||||
TargetFPS = targetFPS;
|
||||
VideoFPS = videoFPS;
|
||||
|
||||
RenderWidth = renderWidth;
|
||||
RenderHeight = renderHeight;
|
||||
|
||||
BitrateMode = bitrateMode;
|
||||
Bitrate = bitrate;
|
||||
MaxBitrate = maxBitrate;
|
||||
QP = qp;
|
||||
|
||||
Codec = codec;
|
||||
EndWaitTime = endWaitTime;
|
||||
ShowHitText = showHitText;
|
||||
|
||||
RandomSeed = randomSeed;
|
||||
}
|
||||
}
|
||||
|
||||
internal struct CapturedFrame
|
||||
{
|
||||
public IntPtr NativePointer;
|
||||
@@ -209,7 +169,7 @@ namespace ADOFAIRenderer.Core
|
||||
DontDestroyOnLoad(_escapeHandlerObj);
|
||||
}
|
||||
|
||||
Time.captureDeltaTime = (float)(1 / Configuration.TargetFPS);
|
||||
Time.captureDeltaTime = (float)(1 / Configuration.RenderFPS);
|
||||
scrController.instance!.StartCoroutine(SetupPlay());
|
||||
}
|
||||
|
||||
@@ -227,7 +187,7 @@ namespace ADOFAIRenderer.Core
|
||||
wonFrame = frameCount;
|
||||
}
|
||||
|
||||
var extraFrames = (long)Math.Ceiling(Configuration.EndWaitTime * Configuration.TargetFPS);
|
||||
var extraFrames = (long)Math.Ceiling(Configuration.DelayAfterLevelEnd * Configuration.RenderFPS);
|
||||
|
||||
if (frameCount - wonFrame < extraFrames) return;
|
||||
isRendering = isCapturing = false;
|
||||
@@ -254,10 +214,10 @@ namespace ADOFAIRenderer.Core
|
||||
Melon<RenderMod>.Logger.Error($"[Render Skipped] Frame {frameCount} rendering failed after 60 retries. Supplying black frame.");
|
||||
|
||||
var currentFrame = frameCountForVideo++;
|
||||
var targetFps = Configuration.TargetFPS;
|
||||
var videoFps = Configuration.VideoFPS;
|
||||
var effectiveVideoFps = Math.Min(videoFps, targetFps);
|
||||
var videoFrameIndex = (long)(currentFrame * effectiveVideoFps / targetFps);
|
||||
var renderFPS = Configuration.RenderFPS;
|
||||
var videoFPS = Configuration.VideoFPS;
|
||||
var effectiveVideoFps = Math.Min(videoFPS, renderFPS);
|
||||
var videoFrameIndex = (long)(currentFrame * effectiveVideoFps / renderFPS);
|
||||
|
||||
if (videoFrameIndex > lastVideoFrameIndex)
|
||||
{
|
||||
@@ -317,11 +277,11 @@ namespace ADOFAIRenderer.Core
|
||||
|
||||
var currentFrame = frameCountForVideo++;
|
||||
|
||||
var targetFps = Configuration.TargetFPS;
|
||||
var renderFPS = Configuration.RenderFPS;
|
||||
var videoFps = Configuration.VideoFPS;
|
||||
var effectiveVideoFps = Math.Min(videoFps, targetFps);
|
||||
var effectiveVideoFps = Math.Min(videoFps, renderFPS);
|
||||
|
||||
var videoFrameIndex = (long)(currentFrame * effectiveVideoFps / targetFps);
|
||||
var videoFrameIndex = (long)(currentFrame * effectiveVideoFps / renderFPS);
|
||||
|
||||
if (videoFrameIndex > lastVideoFrameIndex)
|
||||
{
|
||||
@@ -395,7 +355,9 @@ namespace ADOFAIRenderer.Core
|
||||
isCapturing = true;
|
||||
scrController.instance.paused = scrController.instance.audioPaused = false;
|
||||
scrController.instance.levelWasSkipped = true;
|
||||
|
||||
|
||||
if (!Configuration.ProcessAudio) yield break;
|
||||
|
||||
if (!scrConductor.instance || !scrConductor.instance.song) yield break;
|
||||
AudioSpectrumGenerator.Initialize(scrConductor.instance.song.clip);
|
||||
scrConductor.instance.song.clip = null;
|
||||
@@ -425,19 +387,14 @@ namespace ADOFAIRenderer.Core
|
||||
endRequested = false;
|
||||
endSuccessful = false;
|
||||
|
||||
var targetFps = Configuration.TargetFPS;
|
||||
var videoFps = Configuration.VideoFPS;
|
||||
var bitrateMode = Configuration.BitrateMode;
|
||||
var bitrate = Configuration.Bitrate;
|
||||
var maxBitrate = Configuration.MaxBitrate;
|
||||
var qp = Configuration.QP;
|
||||
var codecStr = Configuration.Codec;
|
||||
var renderFPS = Configuration.RenderFPS;
|
||||
var videoFPS = Configuration.VideoFPS;
|
||||
var bitrateMode = Configuration.EncodingConfig!.RateControlMode;
|
||||
var bitrate = Configuration.EncodingConfig!.Bitrate;
|
||||
var maxBitrate = Configuration.EncodingConfig!.MaxBitrate;
|
||||
var qp = Configuration.EncodingConfig!.QP;
|
||||
|
||||
var selectedCodec = Codec.H264;
|
||||
if (Enum.TryParse<Codec>(codecStr, true, out var parsedCodec))
|
||||
{
|
||||
selectedCodec = parsedCodec;
|
||||
}
|
||||
var selectedCodec = Configuration.Codec;
|
||||
|
||||
var ext = ".mp4";
|
||||
if (selectedCodec == Codec.AV1 || selectedCodec == Codec.VP9)
|
||||
@@ -458,7 +415,7 @@ namespace ADOFAIRenderer.Core
|
||||
FFmpegNativeEncoder? videoFFmpeg = null;
|
||||
try
|
||||
{
|
||||
var effectiveVideoFps = Math.Min(videoFps, targetFps);
|
||||
var effectiveVideoFps = Math.Min(videoFPS, renderFPS);
|
||||
var settings = new FFmpegNativeEncoder.EncoderSettings
|
||||
{
|
||||
Width = Configuration.RenderWidth,
|
||||
|
||||
Reference in new issue
Block a user