SHA256
Change RenderConfig.DelayAfterLevelEnd to DelayAfterEnd
This commit is contained in:
4 files changed
+74
-23
No files matched your search
@@ -1,6 +0,0 @@
|
|||||||
namespace ADOFAIRenderer.API;
|
|
||||||
|
|
||||||
public class Core
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
using System;
|
||||||
|
using ADOFAIRenderer.Core;
|
||||||
|
|
||||||
|
namespace ADOFAIRenderer.API;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fluent builder for configuring and starting a render session.
|
||||||
|
/// </summary>
|
||||||
|
public class RenderSessionBuilder
|
||||||
|
{
|
||||||
|
private bool _auto = true;
|
||||||
|
|
||||||
|
public enum PatchType { Time, Screen }
|
||||||
|
private bool _timePatch = true;
|
||||||
|
private bool _screenPatch = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets whether automatic rendering is enabled.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="enabled"><c>true</c> to enable automatic rendering; otherwise, <c>false</c>. Default is <c>true</c>.</param>
|
||||||
|
/// <returns>The current <see cref="RenderSessionBuilder"/> instance for method chaining.</returns>
|
||||||
|
public RenderSessionBuilder WithAuto(bool enabled = true)
|
||||||
|
{
|
||||||
|
_auto = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RenderSessionBuilder WithPatch(PatchType patchType, bool enabled = true)
|
||||||
|
{
|
||||||
|
switch (patchType)
|
||||||
|
{
|
||||||
|
case PatchType.Time: _timePatch = enabled; break;
|
||||||
|
case PatchType.Screen: _screenPatch = enabled; break;
|
||||||
|
default: throw new ArgumentOutOfRangeException(nameof(patchType), patchType, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Applies the configured flags and initiates the render session.
|
||||||
|
/// </summary>
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
RenderFlags.Auto = _auto;
|
||||||
|
RenderFlags.TimePatch = _timePatch;
|
||||||
|
RenderFlags.ScreenPatch = _screenPatch;
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
-11
@@ -55,26 +55,26 @@ namespace ADOFAIRenderer.Data
|
|||||||
public static List<RenderPreset> GetPresets()
|
public static List<RenderPreset> GetPresets()
|
||||||
{
|
{
|
||||||
var presets = new List<RenderPreset>();
|
var presets = new List<RenderPreset>();
|
||||||
string dir = GetPresetsDirectory();
|
var dir = GetPresetsDirectory();
|
||||||
if (!Directory.Exists(dir))
|
|
||||||
{
|
if (!Directory.Exists(dir)) return presets;
|
||||||
return presets;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string[] files = Directory.GetFiles(dir, "*.json");
|
var files = Directory.GetFiles(dir, "*.json");
|
||||||
foreach (string file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string json = File.ReadAllText(file);
|
var json = File.ReadAllText(file);
|
||||||
var jObject = JsonConvert.DeserializeObject<JObject>(json);
|
var jObject = JsonConvert.DeserializeObject<JObject>(json);
|
||||||
if (jObject != null)
|
if (jObject == null) continue;
|
||||||
{
|
|
||||||
var configToken = jObject["Config"];
|
var configToken = jObject["Config"];
|
||||||
if (configToken is JObject configObj)
|
if (configToken is JObject configObj)
|
||||||
{
|
{
|
||||||
|
TryChangeKey(configObj, "DelayAfterLevelEnd", "DelayAfterEnd");
|
||||||
|
|
||||||
// 1. legacy EncodingConfig -> VideoConfig
|
// 1. legacy EncodingConfig -> VideoConfig
|
||||||
if (configObj["EncodingConfig"] is JObject oldEncodingConfigObj)
|
if (configObj["EncodingConfig"] is JObject oldEncodingConfigObj)
|
||||||
{
|
{
|
||||||
@@ -152,7 +152,6 @@ namespace ADOFAIRenderer.Data
|
|||||||
presets.Add(preset);
|
presets.Add(preset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MelonLogger.Warning($"프리셋 파일 '{Path.GetFileName(file)}' 로드 중 오류 발생: {ex.Message}");
|
MelonLogger.Warning($"프리셋 파일 '{Path.GetFileName(file)}' 로드 중 오류 발생: {ex.Message}");
|
||||||
@@ -167,6 +166,15 @@ namespace ADOFAIRenderer.Data
|
|||||||
return presets;
|
return presets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void TryChangeKey(JObject configObj, string keyBefore, string targetKey)
|
||||||
|
{
|
||||||
|
var legacyToken = configObj[keyBefore];
|
||||||
|
if (legacyToken != null && legacyToken.Type != JTokenType.Null)
|
||||||
|
configObj[targetKey] = legacyToken;
|
||||||
|
|
||||||
|
configObj.Remove(keyBefore);
|
||||||
|
}
|
||||||
|
|
||||||
public static void DeletePreset(string name)
|
public static void DeletePreset(string name)
|
||||||
{
|
{
|
||||||
string dir = GetPresetsDirectory();
|
string dir = GetPresetsDirectory();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using ADOFAIRenderer.Util.FFmpeg;
|
|||||||
|
|
||||||
namespace ADOFAIRenderer.Data
|
namespace ADOFAIRenderer.Data
|
||||||
{
|
{
|
||||||
internal class RenderConfig
|
public class RenderConfig
|
||||||
{
|
{
|
||||||
public double RenderFPS { get; set; }
|
public double RenderFPS { get; set; }
|
||||||
public double VideoFPS { get; set; }
|
public double VideoFPS { get; set; }
|
||||||
@@ -14,18 +14,18 @@ namespace ADOFAIRenderer.Data
|
|||||||
public AudioEncodingConfig AudioConfig { get; set; } = new();
|
public AudioEncodingConfig AudioConfig { get; set; } = new();
|
||||||
public AdvancedConfig AdvancedConfig { get; set; } = new();
|
public AdvancedConfig AdvancedConfig { get; set; } = new();
|
||||||
|
|
||||||
public double DelayAfterLevelEnd { get; set; }
|
public double DelayAfterEnd { get; set; }
|
||||||
public bool ShowJudgementText { get; set; }
|
public bool ShowJudgementText { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class AdvancedConfig
|
public class AdvancedConfig
|
||||||
{
|
{
|
||||||
public int? RandomSeed { get; set; } = null;
|
public int? RandomSeed { get; set; } = null;
|
||||||
public bool ProcessAudio { get; set; } = true;
|
public bool ProcessAudio { get; set; } = true;
|
||||||
public bool NonTile { get; set; } = false;
|
public bool NonTile { get; set; } = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class VideoEncodingConfig
|
public class VideoEncodingConfig
|
||||||
{
|
{
|
||||||
public Codec Codec { get; set; } = Codec.H264;
|
public Codec Codec { get; set; } = Codec.H264;
|
||||||
public RateControlMode RateControlMode { get; set; } = RateControlMode.CBR;
|
public RateControlMode RateControlMode { get; set; } = RateControlMode.CBR;
|
||||||
@@ -35,10 +35,10 @@ namespace ADOFAIRenderer.Data
|
|||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
public int QP { get; set; } = 18;
|
public int QP { get; set; } = 18;
|
||||||
public double KeyframeInterval { get; set; } = 2.0;
|
public double KeyframeInterval { get; set; } = 2.0;
|
||||||
public bool ForceSoftwareEncoder { get; set; } = false;
|
public bool ForceSoftwareEncoder { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class AudioEncodingConfig
|
public class AudioEncodingConfig
|
||||||
{
|
{
|
||||||
private int _audioSampleRate = 44100;
|
private int _audioSampleRate = 44100;
|
||||||
private int _audioChannels = 2;
|
private int _audioChannels = 2;
|
||||||
|
|||||||
Reference in new issue
Block a user