acdream/src/AcDream.App/Composition/SettingsDevToolsComposition.cs

84 lines
3.3 KiB
C#

using AcDream.App.Settings;
using AcDream.App.Plugins;
using AcDream.App.Rendering.Gpu;
using AcDream.App.Rendering.Packs;
using AcDream.UI.Abstractions.Panels.Settings;
using Silk.NET.Input;
namespace AcDream.App.Composition;
/// <summary>
/// Resolved display/audio/quality settings for the session. The optional
/// ImGui developer-tools frontend that used to compose here (VitalsPanel,
/// ChatPanel, DebugPanel, SettingsPanel via <c>AcDream.UI.ImGui</c>) was
/// removed at Campaign V slice V11 along with the OpenGL backend it
/// required — see docs/plans/2026-07-27-vulkan-campaign.md. The
/// ImGui-era SettingsPanel's promised re-home landed as Campaign OP's retail
/// Options panel (<c>OptionsPanelController</c> et al., the retained
/// <c>UiHost</c>/<c>UiRoot</c> tree — D1) instead of a new
/// <c>IPanelRenderer</c> implementation, and its OP9 closeout retired the
/// unrendered ImGui-era SettingsPanel/SettingsVM outright. Keybind remapping
/// is Campaign OP slice OP8's Configure Keyboard screen, persisting to
/// keybinds.json (not retail's <c>.keymap</c> format — register row AP-202).
/// </summary>
internal sealed record SettingsDevToolsResult(
AcDream.UI.Abstractions.Settings.QualitySettings ResolvedQuality)
{
internal RenderPackCatalogSource? RenderPacks { get; init; }
internal RenderPackSelectionSettings RenderPackSelection { get; init; } =
RenderPackSelectionSettings.Retail;
}
internal sealed record SettingsDevToolsDependencies(
RuntimeSettingsController Settings,
IRuntimeSettingsStartupTarget StartupTarget)
{
internal BufferedRenderPackRegistry? RenderPacks { get; init; }
internal IGpuDevice? GpuDevice { get; init; }
}
/// <summary>
/// Production Phase 3: applies the resolved startup display/audio settings.
/// </summary>
internal sealed class SettingsDevToolsCompositionPhase :
ISettingsDevToolsCompositionPhase<
GameWindowPlatformResult<GameWindowGraphics, IInputContext>,
HostInputCameraResult,
ContentEffectsAudioResult,
SettingsDevToolsResult>
{
private readonly SettingsDevToolsDependencies _dependencies;
public SettingsDevToolsCompositionPhase(SettingsDevToolsDependencies dependencies)
{
_dependencies = dependencies ?? throw new ArgumentNullException(nameof(dependencies));
}
public SettingsDevToolsResult Compose(
GameWindowPlatformResult<GameWindowGraphics, IInputContext> platform,
HostInputCameraResult host,
ContentEffectsAudioResult content)
{
ArgumentNullException.ThrowIfNull(platform);
ArgumentNullException.ThrowIfNull(host);
ArgumentNullException.ThrowIfNull(content);
_dependencies.Settings.ApplyStartup(_dependencies.StartupTarget);
RenderPackCatalogSource? renderPacks = null;
if (_dependencies.RenderPacks is { } registry
&& _dependencies.GpuDevice is { } gpu)
{
renderPacks = new RenderPackCatalogSource(
registry,
RenderPackCapabilityResolver.Resolve(gpu.Capabilities));
}
return new SettingsDevToolsResult(_dependencies.Settings.ResolvedQuality)
{
RenderPacks = renderPacks,
RenderPackSelection = _dependencies.Settings.Display.RenderPack,
};
}
}