Skip to content

Diagnostics: opt-in native Graphics settings tab and menu traces - #2863

Draft
AwkGrep256 wants to merge 16 commits into
Marvisak:mainfrom
AwkGrep256:pc-graphics-menu-draft
Draft

AwkGrep256 wants to merge 16 commits into
Marvisak:mainfrom
AwkGrep256:pc-graphics-menu-draft

Conversation

@AwkGrep256

@AwkGrep256 AwkGrep256 commented Nov 25, 2026 •

Copy link
Copy Markdown

Draft · Native Graphics settings on Windows

@Marvisak, VIctory's settings now live inside the game's own Settings → Graphics menu. The Upscaler and Frame generation rows use the native arrows and counter, save to victory.toml, and apply on restart. The stock Graphics rows, which this build ships without text, now all have readable English. Related discussion #2862.

📊 What works

Status Result
✅ In game · cf6ab2b7/f40ffdf8 Upscaler row: arrows, counter, saved choice after reopening Settings, read on the next launch; AMD FSR then upscaled 1080p → 4K.
✅ In game · fdfc1ed3 Every stock Graphics row named (69 by label ID, 8 that have no ID). Frame generation row shows.
✅ In game · 8b10d9bd VIctory's share of opening Settings: ~0.4 ms (was ~4.7 s). The text table is found from DirectStorage reads as they land.
🧪 Next launch · 70ae1381 Headings for the two untitled groups, help text for 5 rows that had none.
🟡 Next Our own option names (Title default / AMD FSR / Off) instead of the borrowed Low / Medium. Frame generation is saved only until frame generation lands on this branch.

🧩 How the settings module works

A VIctory setting is one Rust enum plus one Choice impl. Everything else (the menu row, its range, reading victory.toml, saving it) comes from that impl.

victory.toml ──read──▶ Config ──from_config──▶ ListSetting ◀──▶ native ◀ ▶ row
     ▲                                             │
     └──────────────── file::save ◀── player picks ┘

1. The value (crates/victory-core/src/config.rs): a plain enum, spelled in victory.toml by serde.

#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum FrameGeneration {
    #[default]
    Off,
    AmdFsr,
}

2. The setting (crates/victory-core/src/settings/graphics.rs): where it is saved, what the menu says, and its options.

impl Choice for FrameGeneration {
    const CONFIG: ConfigKey = ConfigKey { section: "graphics", key: "frame_generation" };
    const NAME: Text = Text::own("victory_frame_generation", "Frame generation");
    const HELP: Text = Text::own(
        "victory_frame_generation_desc",
        "Inserts generated frames between rendered ones for smoother motion. \
         Applies after a restart.",
    );
    const OPTIONS: &'static [Opt<Self>] = &[
        Opt { value: FrameGeneration::Off,    label: Text::own("victory_frame_generation_off", "Off"),         toml: "off" },
        Opt { value: FrameGeneration::AmdFsr, label: Text::own("victory_frame_generation_amd_fsr", "AMD FSR"), toml: "amd_fsr" },
    ];

    fn from_config(config: &crate::Config) -> Self {
        config.frame_generation
    }
}

3. The row (apps/victory/src/menu_trace/settings_list.rs): one line makes it a menu row.

pub(super) static FRAME_GENERATION: ListSetting = ListSetting::of::<FrameGeneration>();
pub(super) static ALL: [&ListSetting; 2] = [&UPSCALER, &FRAME_GENERATION];

What the trait gives for free:

From the impl Used for
OPTIONS.len() The row's range (◀ ▶ stops at the ends)
from_config The choice shown when Settings opens
Opt::toml + CONFIG file::save rewrites just [graphics] frame_generation = '…', keeping the user's comments and order
NAME / HELP / Opt::label Menu text, added to the title's text table

Checks that stop mistakes at test time:

#[test]
fn frame_generation_is_well_formed() {
    assert_eq!(validate::<FrameGeneration>(), Ok(())); // no duplicate values, spellings or label IDs
}

#[test]
fn frame_generation_spellings_load_back() {
    assert_matches_serde::<FrameGeneration>();         // what the menu saves, victory.toml loads
}

Text::own refuses any key that doesn't start with victory_, at compile time, so our IDs stay apart from the title's.

🏷️ Text for the game's own rows

The same module holds the English for the stock rows (crates/victory-core/src/settings/stock_labels.rs), one table per language:

// A labelled row: matched by its name and help IDs, never by position.
StockLabel {
    name_id: 0x0b25_dfcf,
    name: "Upscaling quality",
    help_id: 0xda15_102a,
    help: Some("Render resolution used by the upscaler. Lower is faster, higher is sharper."),
},

// A row with no name ID: recognised by the labelled row before it.
UnnamedRow {
    after: 0x4d02_1b51, // Particle lighting quality
    nth: 1,
    name: Text::own("victory_stock_character_textures", "Character texture quality"),
    help: Text::own("victory_stock_character_textures_desc", "Resolution of character textures."),
},

// A group built without a heading: recognised by a row it holds.
GroupHeading {
    holds: 0xff7f_05de, // Display adapter
    heading: Text::own("victory_stock_group_display", "Display"),
},

The app side only applies these tables: it adds the text to the menu's text table and, as the title builds a nameless row or an untitled group, writes VIctory's IDs into it. If an update moves things, a row stays blank rather than getting the wrong name.

🌍 Localization proposal

The English for every VIctory control and every stock Graphics row is written and in one file. Would you like VIctory to ship translations for all languages the title supports? Each language is one more table next to EN, selected by VICTORY_LOCALE.

🧪 Try the draft

Use a Windows diagnostics build, Series X mode, title build 1.0.2.1, and a copied profile and config. Enable VICTORY_MENU_GRAPHICS=1 and VICTORY_MENU_UPSCALING_PROBE=1. Open Settings → Graphics: the stock rows should all have names, and the Upscaling section holds VIctory's two rows. Change only the VIctory rows. Applying a stock Graphics change previously caused an OOM, so please leave stock options and reset alone.

The menu and save test can run without the SDK. For host FSR after relaunch, point VICTORY_FIDELITYFX_DIR at the signed DX12 DLL folder and leave the manual upscaler and scale overrides unset.

@kotekompotek, @Jrjy3, and @z395977743-svg, thanks for the previous review and testing. A quick check on another setup would help. Please include the commit, GPU, and whether the row names, counter and saved choice behaved as expected.

Developer guide · Related Series X FSR work #1793 · The null placed-resource fix is a separate commit, 69e80cd1.

VICTORY_MENU_GRAPHICS=1 registers the title's hidden Graphics section
right after Video through its own section-registration code, on builds
whose call sites match the validated byte patterns. Unrecognized builds
are left alone.

VICTORY_MENU_ROW_TRACE=1 logs the row IDs created for Video and
Graphics. VICTORY_MENU_TRACE=1 logs section registration, controller
changes and the settings save path.

All switches are off by default. Confirming a change to a stock
Graphics option can crash the title, so the tab is for browsing only.

@kotekompotek kotekompotek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scoped review: +1500 but almost all additive — new opt-in menu_trace/settings_trace modules plus plumbing, flag-gated behind a diagnostics switch, so it can't affect a default run. The xgamesave extension (listing container contents) is the only behavioral surface outside the flag; reads like an additive query API. Worth a maintainer pass on the trace-format stability, but the risk profile is low.

@AwkGrep256

Copy link
Copy Markdown
Author

Thanks for the review. One correction: the xgamesave change is also behind the switch. It only builds with the diagnostics feature and only runs with VICTORY_MENU_TRACE=1. It records what a settings save writes, compared with the blob it replaces, and adds no new API. Default runs are unchanged.

AwkGrep256 and others added 4 commits November 26, 2026 03:40
alias_source read the resource behind a null handle and faulted at
startup (read of address 0x30). Return None for a null handle, like
host_resource does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VIctory settings are now fieldless enums implementing `Choice`
(victory-core::settings): options, menu labels and victory.toml spelling
in one impl. From it follow the native ◀ ▶ row in Settings → Graphics,
loading at startup and saving when the player changes the value.

- settings::text: const joaat, `Text::own` rejects non-`victory_` keys
  at compile time so our labels cannot replace the title's.
- settings::choice: `Choice`, `validate()` (unique options, plain
  spellings, default among them).
- settings::file: rewrites one `[section] key` line of victory.toml,
  keeping comments and layout; replaces the file in one rename.
- menu_trace::native_list: the only unsafe part. Turns a pooled title row
  into a list row with an empty descriptor and a copy of the quality
  list's function table (refresh, enabled, publish, commit are ours).
  Commit saves the pick and posts the title's "settings changed" event so
  the counter follows. The UI context passed to publish lives on the
  caller's stack and is never kept.
- menu_trace::settings_list / upscaling: the settings as rows, the
  Upscaling section built from them.
- The hidden Graphics tab is named: a tab shows its screen ID's text.
- The menu text scan reads through read_memory, so a region the title
  decommits mid-scan is skipped instead of faulting.

Behind VICTORY_MENU_GRAPHICS and VICTORY_MENU_UPSCALING_PROBE. How to add
or tweak a setting: docs/native-settings.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From review:
- Saving parses the edited victory.toml and refuses unless only the one
  key changed (inline tables and dotted keys are refused, not mangled);
  unique temp file, removed if the replace fails.
- A pick is saved before it becomes the choice: a failed save keeps the
  old choice and can be retried.
- The config path is made absolute at load (the title can change the
  working directory).
- Native list rows check that the commit-side table is the primary
  table's slot 10 and that what they read lies in the image; unaligned
  reads.
- A row is adopted only if the helper appended exactly one, non-null row.
- One registry of list settings for loading and for the section's rows.
- Docs: the `victory_` prefix is a naming rule, not collision-proof;
  upscaling.rs also touches title memory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AwkGrep256

Copy link
Copy Markdown
Author

Belobug/VIctory-Belobug-AMD#274 tracks a test port of the native Graphics settings on Belobug’s current AMD fork. It links back here and has the menu, FSR and frame-generation test matrix. The upstream menu’s working save flow is the starting point. Fork gameplay results will go on Belobug/VIctory-Belobug-AMD#118 with the exact tested build.

AwkGrep256 and others added 10 commits November 27, 2026 00:51
The Graphics text census swept every loaded text map on the menu
thread the first time Settings built the tab. It now only runs with
VICTORY_MENU_TEXT_CENSUS=1. Map discovery and the census log their
duration so the Settings open delay can be attributed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A search that ran before the Settings text map was loaded swept all
mapped memory on the menu thread (~4.5 s). Each search now stops after
400 ms, checked before every chunk; the next menu visit searches again.
A hit takes ~0.25 s and is cached for later visits.

Also adds an opt-in probe (VICTORY_MENU_TEXT_PATH_PROBE) that looks for
a pointer to the map in the title image, to replace the search later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Settings text map is loaded from a file when Settings opens. The
DirectStorage module now keeps the last 512 plain reads (no texture
unpacking, up to 16 MiB each), and the menu looks for the map in those
buffers, newest first, with the same shape checks as before: 29 us in
game instead of ~0.25 s for the memory search. No address or offset is
assumed.

A miss usually means the file is not loaded yet, so the next menu visit
looks again; only three misses in a row fall back to the time-boxed
memory search. Each read can also be logged (dstorage_dest=debug).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The DirectStorage reader can now watch for one 4-byte word: every plain
read that lands is checked for it on the reading thread, and the spots
are kept (only hits, so loads never push them out). The menu watches for
the text map's type hash and then only validates those spots, in
microseconds, on its own thread.

The menu thread no longer searches memory at all. After repeated misses
(a build that keeps the map elsewhere), one read-only search runs on a
background thread and leaves its result for a later visit. The image
pointer probe found nothing and is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The title's own Graphics rows show blank: this build does not load
their text. Each row names itself by joaat(key) and its help by
joaat(key + "_desc"). settings::stock_labels holds VIctory's English
for five rows whose keys are confirmed by their hashes (tested against
the rows' IDs), one table per language. The menu text provider adds them
with VIctory's own labels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rows are matched by their name and help IDs instead of label keys, so
all 69 stock rows that carry a name ID get VIctory's English (the other
eight have none to attach text to). Five recovered keys still check the
ID scheme in the tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[graphics] frame_generation (off / amd_fsr) is read from victory.toml
and shown as a second native list row through the same Choice impl as
the upscaler, saved when changed. It is a setting only for now: this
branch does not insert generated frames yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Eight stock Graphics rows carry no name ID, so no text can be found for
them. The row hook now recognises each by the labelled row before it
(the nth nameless row after a given name ID, not a position) and gives
it VIctory's IDs and English as the title builds it.

Also logs every settings group's heading ID once, found through the
owner's group array that holds VIctory's own group, to give the stock
headings text next.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Some stock Graphics groups are built with heading ID 0, so they show no
title. After the stock rows are built, each such group in the owner's
group array (the one holding VIctory's group) gets VIctory's heading,
recognised by a row it holds. Five named rows without a help ID get
VIctory's help the same way the nameless rows get their names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AwkGrep256

Copy link
Copy Markdown
Author

Update: now at e476e1a6 (still a draft)

Area Change In game
Menu text lookup Found from DirectStorage reads as they land; no memory search on the menu thread ✅ ~0.4 ms on first Settings open (was ~4.7 s)
Stock Graphics rows VIctory English for every row, including 8 rows with no name ID ✅ all rows named
Frame generation Second Choice row, saved as [graphics] frame_generation ✅ row shows; saving shares the Upscaler path; not applied yet
Group headings, missing help Untitled groups and 5 rows get VIctory's text 🧪 next launch
Option names Still borrowed (Low / Medium) ⏳ next

Wording lives in crates/victory-core/src/settings/stock_labels.rs; how it fits is in docs/native-settings.md. cargo xtask policy, clippy and tests pass. Findings and details: #2862.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants