Files
frameledger/src/FrameLedger.App/ViewModels/SessionItemViewModel.cs
T
poli0981andClaude Opus 5.5 a6717fe3ca feat: the quality mode the NVIDIA App set, where the driver reports its override applied - on every page that names the upscaler; the driver line reads NGX's numbering (D63, beta.24 PR-7) (#322)
- Application: Recording/QualityResolver (D63). When DLSS super resolution ran (a hook named it, or the
  driver saw it created and evaluated) and the driver's per-process word says an NVIDIA App override
  applied (ENABLED with PERF_MODE, SR_DLAA_MODE or SCALING_RATIO), the mode is the profile's
  NGX_DLSS_SR_MODE checked against the word's performanceMode; DLAA from its bit; a custom ratio with
  its percent. Disagreement, or a report that does not settle, reads as overridden with no mode - never
  the game's value. Otherwise the hooked Streamline byte; otherwise none. Read at display time from
  ngx_driver_words and driver_profile, so sessions recorded before resolve alike. NgxDriverWords.Parse;
  the live progress event gains upscalerQualityOverride (07_IPC: optional, from the report alone).
- Domain: UpscalerQualityMode, and UpscalerNames decodes the three numberings - the hooked byte
  (sl::DLSSMode), the driver's report (NGX's own: measured on the owner's ledger, Silent Hill 2 under the
  App's Ultra Performance, profile 5, was reported as 3) and the profile (NGX_DLSS_SR_MODE).
- App: Formats.UpscalerOf(SessionRow / SessionProgressEvent) on the summary, the Sessions tab, the game
  page and the live card ("DLSS (driver-reported) Quality · NVIDIA App", "· NVIDIA App override"); mode
  names from resx; the driver line decodes the report in NGX's numbering (it printed nothing for 3 and
  would have printed a DLAA override's 5 as Ultra Performance); CSV "# quality_mode:".
- Native: five comments that called a quality byte of 0 "NGX MaxPerf" corrected - comments only.
- Strings: 4 new keys en/vi/ja (ja marked review).
- Tests: QualityResolverTests (the owner's Silent Hill 2 and Expedition 33 words as fixtures),
  UpscalerNamesTests, FormatsTests, NvidiaOverridesTests, SessionProgressCalculatorTests,
  SessionExporterTests, MetricEnumMirrorTests.
- Docs: 03_METRICS Upscaling (D63 amendment; the beta.8 sentence struck for the mode only), 05_DETECTION,
  07_IPC, 08_UI, 18_GPU_VENDOR_APIS, LIMITATIONS, guide 03/10, CHANGELOG; legal/ACCURACY.md's Quality mode
  bullet in the words approved with the plan, without its FSR clause; Disclaimer 2.11.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 19:18:55 +07:00

122 lines
5.5 KiB
C#

// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.Globalization;
using FrameLedger.App.Services;
using FrameLedger.Application.Persistence;
using FrameLedger.Application.TriState;
using FrameLedger.Domain.Sessions;
namespace FrameLedger.App.ViewModels;
/// <summary>
/// One row of the Sessions tab (FR-6.1) as text, decided once: the tier badge, the three FPS columns under
/// <see cref="FpsPresentation"/> (<c>—</c> for a measured none, <c>N/A</c> for not measured, never blank, never
/// zero — FR-4.9), the lows, resolution · upscaler, the chips resolved with the annotation and the game default.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1863:Use 'CompositeFormat'", Justification = "the format strings are resources that follow the UI culture, which changes at runtime")]
public sealed class SessionItemViewModel
{
public SessionItemViewModel(SessionRow row, SessionAnnotation? annotation, GameRow game)
{
ArgumentNullException.ThrowIfNull(row);
ArgumentNullException.ThrowIfNull(game);
Row = row;
Id = row.Id;
DateText = Formats.Date(row.StartedAt);
DurationText = Formats.Duration(row.DurationSeconds);
IsHooked = row.Tier == CaptureTier.Hooked;
// D33: a hooked session under the game's user-mode exception is marked with it wherever its tier is said.
TierText = !IsHooked ? Strings.Tier_NotHooked : row.AcExceptionFamily is null ? Strings.Tier_Hooked : Strings.Tier_HookedException;
TierTooltip = !IsHooked ? Strings.Tier_NotHooked_Tooltip
: row.AcExceptionFamily is { } family
? Strings.Tier_Hooked_Tooltip + Environment.NewLine + string.Format(CultureInfo.CurrentCulture, Strings.Session_UnderException_Format, family)
: Strings.Tier_Hooked_Tooltip;
NativeText = FpsPresentation.NativeColumn(row);
DisplayedText = FpsPresentation.DisplayedColumn(row);
FgText = FpsPresentation.FactorColumn(row);
FpsTooltip = FpsPresentation.ColumnTooltip(row);
P1LowText = IsHooked ? Formats.Fps(row.P1LowFps) : Strings.Common_NotAvailable;
P01LowText = IsHooked ? Formats.Fps(row.P01LowFps) : Strings.Common_NotAvailable;
ResolutionText = IsHooked ? Formats.Resolution(row.RenderW, row.RenderH, row.OutputW, row.OutputH) + " · " + Formats.UpscalerOf(row) : Strings.Common_NotAvailable;
GpuTempText = Formats.Temperature(row.MaxGpuTemp);
// beta.12 (D43), both tiers: the game's own memory, median · peak, the rest in the tooltip.
IReadOnlyDictionary<string, Application.Recording.SensorSeriesStats> stats = Application.Recording.SensorSeriesStats.Parse(row.SensorStatsJson);
GameVramText = GameMemoryText.VramCell(row);
GameVramTooltip = GameMemoryText.VramTooltip(row);
GameRamText = GameMemoryText.RamCell(row, stats);
GameRamTooltip = GameMemoryText.RamTooltip(row, stats);
// beta.10: both tiers — the window is read out of process whether or not the game was hooked.
Domain.Display.DisplaySummary? display = DisplayText.Of(row);
DisplayModeText = DisplayText.Headline(display);
DisplayModeTooltip = DisplayText.Line(display);
ApiText = IsHooked ? Formats.Api(row.Api) : Strings.Common_NotAvailable;
ExitText = Formats.ExitStatusText(row.ExitStatus);
IsCrashed = row.ExitStatus == ExitStatus.Crashed;
TagsText = annotation is null ? string.Empty : string.Join(", ", annotation.Tags);
Rt = TriStateChipModel.Of(TriStateKind.RayTracing, TriStateResolution.Resolve(TriStateKind.RayTracing, row, annotation, game));
Pt = TriStateChipModel.Of(TriStateKind.PathTracing, TriStateResolution.Resolve(TriStateKind.PathTracing, row, annotation, game));
Rr = TriStateChipModel.Of(TriStateKind.RayReconstruction, TriStateResolution.Resolve(TriStateKind.RayReconstruction, row, annotation, game));
}
public SessionRow Row { get; }
public long Id { get; }
public string DateText { get; }
public string DurationText { get; }
public bool IsHooked { get; }
public string TierText { get; }
public string TierTooltip { get; }
public string NativeText { get; }
public string DisplayedText { get; }
public string FgText { get; }
public string? FpsTooltip { get; }
public string P1LowText { get; }
public string P01LowText { get; }
public string ResolutionText { get; }
public string GpuTempText { get; }
/// <summary>The game's dedicated video memory, median · peak; N/A for a session recorded before beta.12.</summary>
public string GameVramText { get; }
public string? GameVramTooltip { get; }
/// <summary>The game's private working set, median · peak — or its working set, labelled; N/A before beta.12.</summary>
public string GameRamText { get; }
public string? GameRamTooltip { get; }
/// <summary>The mode the session was shown in longest, with its share; N/A for a row recorded before beta.10.</summary>
public string DisplayModeText { get; }
/// <summary>Every share, the window on its monitor, the back buffer and the source; null for a row without display facts.</summary>
public string? DisplayModeTooltip { get; }
public string ApiText { get; }
public string ExitText { get; }
public bool IsCrashed { get; }
public string TagsText { get; }
public TriStateChipModel Rt { get; }
public TriStateChipModel Pt { get; }
public TriStateChipModel Rr { get; }
}