Show the graphics card beside the levels

Its name and memory, with the other cards in the tooltip. Windows has them in the
registry. On Linux the name comes from the driver or pci.ids and the memory from
amdgpu or nvidia-smi; without either there is only the name. A card in a processor
says shared memory, as what it reports is a share set in the firmware.

No rating of the card against the settings: what a ride takes depends on the
textures of its scenery and vehicles, which are not known before it starts.
This commit is contained in:
maj00r
2026-11-01 20:54:01 +01:00
parent a7c9cdb97f
commit 42b2259b7c
13 changed files with 489 additions and 4 deletions

View File

@@ -99,6 +99,8 @@ public partial class Settings : UserControl, ISettingsCapture
_keyRows.Changed += QueuePresetMarks;
BuildPresetButtons();
BuildMonitorRates();
ReadGraphicsCards();
App.Loc.LanguageChanged += UpdateCardText;
App.Loc.LanguageChanged += _keyRows.UpdateTexts;
FeedbackCb.SelectionChanged += FeedbackCb_OnSelectionChanged;
@@ -625,6 +627,32 @@ public partial class Settings : UserControl, ISettingsCapture
_markingLevels = false;
}
// ── The player's graphics card, beside the levels ────────────────────────
private IReadOnlyList<GraphicsCard> _cards = Array.Empty<GraphicsCard>();
private async void ReadGraphicsCards()
{
var reader = AppServices.Current.GraphicsCards;
_cards = await Task.Run(() => reader.List());
UpdateCardText();
}
private static string CardLine(GraphicsCard card) =>
card.SharedMemory ? string.Format(App.Loc["GpuCardShared"], card.Name)
: card.MemoryBytes > 0 ? string.Format(App.Loc["GpuCard"], card.Name, card.MemoryGb)
: card.Name;
private void UpdateCardText()
{
CardText.IsVisible = _cards.Count > 0;
if (_cards.Count == 0)
return;
CardText.Text = CardLine(_cards[0]);
ToolTip.SetTip(CardText, string.Join(Environment.NewLine, _cards.Select(CardLine)));
}
// ── The screens' refresh rates, for the frame rate limit ─────────────────
private static readonly IBrush FgDimBrush = new SolidColorBrush(Color.Parse("#9098A0"));