Add Custom Output Path API

This commit is contained in:
copecone committed 2026-08-18 11:02:08 +09:00
1 parent 2a5ceb4889
commit bdc8b4abb0
2 files changed
+10 -4

No files matched your search

+4 -2
View File
@@ -1,4 +1,5 @@
using System;
using System.IO;
using ADOFAIRenderer.Core;
using ADOFAIRenderer.Data;
using ADOFAIRenderer.Util;
@@ -32,7 +33,7 @@ public class RenderSession
private bool _screenPatch = true;
private Func<bool> _endCondition = () => scrController.instance.state == States.Won;
private string? _outputPath = null;
private string? _outputPath;
/// <summary>
/// Sets whether auto mode is enabled.
@@ -92,6 +93,7 @@ public class RenderSession
RenderContext.TimePatch = _timePatch;
RenderContext.ScreenPatch = _screenPatch;
RenderContext.EndCondition = _endCondition;
RenderContext.OutputPath = _outputPath;
RenderManager.Instance.levelPath = levelPath;
RenderManager.Instance.Configuration = renderConfig;
@@ -99,7 +101,7 @@ public class RenderSession
RenderManager.Instance.StartLoadingOverride();
if (_outputPath is null) RenderManager.Instance.SetupCaptureDirectory();
else FileUtil.CreateDirectory(_outputPath);
else FileUtil.CreateDirectory(Path.GetDirectoryName(_outputPath) ?? throw new InvalidOperationException());
RenderManager.Instance.SetupGameScene();
}
+6 -2
View File
@@ -27,12 +27,14 @@ namespace ADOFAIRenderer.Core
public static bool TimePatch = true;
public static bool ScreenPatch = true;
public static Func<bool> EndCondition = () => scrController.instance.state == States.Won;
public static string? OutputPath;
public static void Reset()
{
Auto = true;
TimePatch = true; ScreenPatch = true;
EndCondition = () => scrController.instance.state == States.Won;
OutputPath = null;
}
}
@@ -411,7 +413,7 @@ namespace ADOFAIRenderer.Core
private IEnumerator SetupPlay()
{
if (Configuration.AudioConfig.RenderAudio && GetOutputExtension(Configuration.VideoConfig.Codec) != ".mp4")
if (Configuration.AudioConfig.RenderAudio && Configuration.VideoConfig.Codec is Codec.VP9 or Codec.AV1 or Codec.VVC)
{
Configuration.AudioConfig.AudioSampleRate = 48000;
}
@@ -506,11 +508,13 @@ namespace ADOFAIRenderer.Core
var fileName = startTime.ToString("yyyy-MM-dd HH-mm-ss") + ext;
_currentOutPath = Path.Combine(MelonEnvironment.GameRootDirectory, "Render", fileName);
if (RenderContext.OutputPath != null) _currentOutPath = RenderContext.OutputPath;
FFmpegNativeEncoder? videoFFmpeg = null;
try
{
var effectiveVideoFps = Math.Min(videoFPS, renderFPS);
var codecId = GetAudioCodecId(ext);
var codecId = AudioCodecMatch[Configuration.VideoConfig.Codec];
var settings = new FFmpegNativeEncoder.EncoderSettings
{
Width = Configuration.RenderWidth,