refactor(settings): own two-phase runtime settings

Move pre-window loading, startup application, live settings mutation, toon context, quality reapply, and SettingsVM loans behind one RuntimeSettingsController. Preserve retail command behavior, ordered target publication, draft semantics, and retryable failure convergence while removing duplicate GameWindow state and feature bodies.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-22 13:30:22 +02:00
parent 4eae9b4f5a
commit fec0d94148
24 changed files with 2379 additions and 599 deletions

View file

@ -4,13 +4,13 @@ using AcDream.App.Input;
using AcDream.App.Rendering.Selection;
using AcDream.App.Rendering.Vfx;
using AcDream.App.Rendering.Wb;
using AcDream.App.Settings;
using AcDream.App.Streaming;
using AcDream.App.World;
using AcDream.Core.Lighting;
using AcDream.Core.Physics;
using AcDream.Core.Rendering;
using AcDream.Core.World;
using AcDream.UI.Abstractions.Panels.Settings;
namespace AcDream.App.Rendering;
@ -348,18 +348,18 @@ internal sealed class RuntimeWorldFrameVisibilityPreparation
internal sealed class RuntimeWorldFrameSettingsPreview : IWorldFrameSettingsPreview
{
private readonly SettingsVM? _settings;
private readonly IRuntimeSettingsPreviewSource _settings;
private readonly OpenAlAudioEngine? _audio;
private readonly CameraController _cameras;
private readonly DisplayFramePacingController _pacing;
public RuntimeWorldFrameSettingsPreview(
SettingsVM? settings,
IRuntimeSettingsPreviewSource settings,
OpenAlAudioEngine? audio,
CameraController cameras,
DisplayFramePacingController pacing)
{
_settings = settings;
_settings = settings ?? throw new ArgumentNullException(nameof(settings));
_audio = audio;
_cameras = cameras ?? throw new ArgumentNullException(nameof(cameras));
_pacing = pacing ?? throw new ArgumentNullException(nameof(pacing));
@ -367,23 +367,15 @@ internal sealed class RuntimeWorldFrameSettingsPreview : IWorldFrameSettingsPrev
public void Apply(in WorldCameraFrame camera)
{
if (_audio is { IsAvailable: true } && _settings is not null)
if (_settings.HasDraftPreview)
{
var audio = _settings.AudioDraft;
_audio.MasterVolume = audio.Master;
_audio.MusicVolume = audio.Music;
_audio.SfxVolume = audio.Sfx;
_audio.AmbientVolume = audio.Ambient;
}
if (_settings is not null)
{
var display = _settings.DisplayDraft;
float fieldOfView = display.FieldOfView * (MathF.PI / 180f);
_cameras.Orbit.FovY = fieldOfView;
_cameras.Fly.FovY = fieldOfView;
if (_cameras.Chase is not null)
_cameras.Chase.FovY = fieldOfView;
RuntimeSettingsStartupTargets.ApplyAudio(
_audio,
_settings.AudioPreview);
var display = _settings.DisplayPreview;
RuntimeSettingsStartupTargets.ApplyFieldOfView(
_cameras,
display.FieldOfView);
_pacing.ApplyPreference(display.VSync);
}