Display settings at run time: window mode toggle, fps limit and an in-game settings menu (design, phased) #727

Open
opened 2026-11-25 05:48:25 +00:00 by Revens2 · 2 comments
Revens2 commented 2026-11-25 05:48:25 +00:00 (Migrated from github.com)
Contributor

Imported from fxceless/victory-fork. Originally posted by Revens2 on 2026-11-25T05:48:25Z.


Problem

Display and frame settings can only be changed before a run (config file or environment variables) and, for the window, not at all yet. A player who wants to switch between windowed, borderless and fullscreen, pick a resolution, turn vsync on or off, or cap the frame rate has to quit, edit victory.toml and start again. There is no in-game way to do it, and nothing to open one with.

This is a feature request and a design for it. It is not a bug report and it does not depend on any title data.

No open or closed issue asks for this. Open PRs that overlap in part:

  • #433: [window] size in victory.toml (title, <w>x<h>, fullscreen as a borderless popup), per-monitor DPI awareness, closing the presenting window ends the title. Start-up configuration only; no runtime switch, no menu.
  • #131: borderless window by default (one commit in host.rs). It conflicts in intent with #433's title mode; one of the two should win.
  • #717: F3 on-screen panel of where the frame goes (GDI text drawn into a bitmap once a second, copied onto the back buffer in each present). Diagnostic only, read-only, no interaction.
  • #577: keyboard and mouse as a PC game (mouse look, [controls]). Touches the same input path a menu would have to take over.
  • #656 and #434: caption text of the presenting window.

This issue proposes the interactive layer on top of those. It should not duplicate them; where a phase below is already in one of them, the phase says so.

Current state of the code (origin/main at 310c6eb)

  • Presenting window. Host::presenter in crates/victory-gpu/src/host.rs uses title_window() (the first visible top-level window of the process) and otherwise window(w, h), which starts a victory-window thread running make_window (class VIctory, WS_OVERLAPPEDWINDOW | WS_VISIBLE, default position) and a bare message pump; window_proc is DefWindowProcW only. Per #433, the title keeps its own windows hidden, so in practice the presenting window is ours (this is read from #433's description and title_window's filter on visibility; not re-measured).
  • Swap chain. IDXGISwapChain3, DXGI_SWAP_EFFECT_FLIP_DISCARD, BUFFERS = 2, sized to the title's frame (Width/Height of the presented texture), made with CreateSwapChainForHwnd. ResizeBuffers is called when the presented size or format changes (after settle_now(WHY_SYNC)). Each present copies the title's texture into the back buffer (CopyResource) and calls Present(0, 0).
  • Overlay precedent. #717 adds a copy of an upload buffer onto the back buffer inside present. That is the place an interactive menu would draw too.
  • Input. crates/victory-hle/src/modules/gameinput.rs polls GetAsyncKeyState for virtual keys 0x08..=0xFE while the process has focus and hands them to the title as a keyboard device; the same keys drive the stand-in gamepad (FALLBACK_BUTTONS: Esc, Tab, Enter, Backspace, X, Y, arrows, Q, E, F, H, plus W/A/S/D, I/J/K/L, Z, C). There is no filter between the OS and the title: any key reaches it. A menu key would therefore also reach the title unless the input module is told to stop.
  • Config. victory-core/src/config.rs holds paths only (game_dir, cache_dir, data_dir, test_titles); display settings are not part of Config on main (#433 adds [window]).
  • Frame rate. Present(0, 0) has no limiter of its own. The only pacing is the title's own clock (crates/victory-gpu/src/frame.rs), which is a separate topic (see the frame pacing issue).

Proposal, in deliverable phases

  1. Window mode at run time, no menu. Alt+Enter and/or F11 toggle windowed / borderless fullscreen on the presenting window (style change plus SetWindowPos over the monitor the window is on; remember the windowed rectangle). Builds on #433 (start-up mode) and replaces #131. The swap chain keeps the title's size and the DXGI scaler stretches it (as #433 documents), so aspect handling is a decision to make here: either keep stretching or letterbox to the title's aspect ratio. Acceptance below. Small enough for one PR.
  2. Frame-rate limiter. [display] fps_limit (0 = off) applied in present before Present, with a sleep-then-spin wait on a monotonic clock. No change to the title's frame clock. Also small enough for one PR. Effect is only visible when frames are faster than the limit; in the world today frames are far slower (many reports in this repository measure 0.4 to 5 fps), so this is useful in menus and videos first. Not verified for any other case.
  3. Settings model. One [display] table in victory.toml (mode, size, vsync, fps_limit) with VICTORY_* overrides, parsed in victory-core, shared by victory-gpu. Coordinate with #433's [window] so there is one table, not two.
  4. Menu. A key (proposal: F10; F3 is taken by #717, Esc/Tab/Enter are the title's) opens a text menu drawn like #717's panel (GDI into a bitmap, uploaded and copied onto the back buffer, no new dependency). Items: mode, resolution (list from the monitor, applied as window size, not as a title render size), vsync, fps limit, overlay on/off. Navigation by arrows/Enter/Esc while it is open.
  5. Input capture. While the menu is open, gameinput hands the title an idle keyboard and pad (no keys, no stand-in pad), then returns to normal on close; the key that opened the menu is also masked. Needs a shared flag between victory-gpu (owner of the menu) and victory-hle (owner of input); the direction of that dependency is a design choice to make before coding.
  6. Persistence. Changes made in the menu are written back to victory.toml only on an explicit "save".

Risks and open points

  • Changing the swap chain size or style while presents are sent ahead (late_free_present) must go through settle_now the way ResizeBuffers already does; not tested.
  • Window style changes on a window whose message loop runs on its own thread (victory-window) must be marshalled to that thread or use SetWindowPos/ShowWindow that are safe cross-thread; not verified.
  • Exclusive fullscreen (SetFullscreenState) is not proposed: flip-model borderless is enough, and a mode switch on a device that can be removed is a new failure mode.
  • Resolution here means the window / output size. The title renders at its own size; render-resolution changes belong to the upscaling issue.
  • Linux/Proton: window styles and DPI behave differently there (see #131's motivation); not verified.
  • No licence issue: no third-party code.

Acceptance criteria (measurable)

  • Phase 1: toggling twice returns to the same window rectangle (compare GetWindowRect before and after); no device removed, no swap-chain error in the log across 20 toggles in a run that reaches the first menu; the frame counter keeps increasing after each toggle.
  • Phase 2: with fps_limit = 60 on a scene that exceeds 60 fps without the limit, the mean present interval over 10 s is 16.7 ms +/- 1 ms and the standard deviation is below 1 ms (from the present timestamps #717/bench.ps1 already record); with 0 the interval is unchanged from main.
  • Phases 3 to 5: with the menu open, 10 s of key presses produce no change in the title's input (compare the stand-in pad's readings or a test with a recorded input log); closing the menu restores input within 2 frames.
  • cargo test --workspace --locked stays green; each phase adds a unit test for its parsing and state machine.

Not verified

  • Which window the presenting path uses on a given host (title window vs victory-window) beyond #433's statement.
  • Behaviour of ResizeBuffers after a style change while presents are in flight.
  • Any behaviour under Proton/Wine.

Next step

Phases 1 and 2 are simple and independent of the title. If there is no objection, a PR for phase 1 (stacked on #433 if it is merged first, otherwise rebased on main) and a separate PR for phase 2 will follow.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6598133591 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/issues/727). Originally posted by [Revens2](https://github.com/Revens2) on 2026-11-25T05:48:25Z. --- ## Problem Display and frame settings can only be changed before a run (config file or environment variables) and, for the window, not at all yet. A player who wants to switch between windowed, borderless and fullscreen, pick a resolution, turn vsync on or off, or cap the frame rate has to quit, edit `victory.toml` and start again. There is no in-game way to do it, and nothing to open one with. This is a feature request and a design for it. It is not a bug report and it does not depend on any title data. ## Related work (checked 2026-11-25, `gh issue list --state all` and `gh pr list --state all`, searches: fullscreen, borderless, menu, overlay, window, vsync, fps limit) No open or closed issue asks for this. Open PRs that overlap in part: - #433: `[window] size` in `victory.toml` (`title`, `<w>x<h>`, `fullscreen` as a borderless popup), per-monitor DPI awareness, closing the presenting window ends the title. Start-up configuration only; no runtime switch, no menu. - #131: borderless window by default (one commit in `host.rs`). It conflicts in intent with #433's `title` mode; one of the two should win. - #717: F3 on-screen panel of where the frame goes (GDI text drawn into a bitmap once a second, copied onto the back buffer in each present). Diagnostic only, read-only, no interaction. - #577: keyboard and mouse as a PC game (mouse look, `[controls]`). Touches the same input path a menu would have to take over. - #656 and #434: caption text of the presenting window. This issue proposes the interactive layer on top of those. It should not duplicate them; where a phase below is already in one of them, the phase says so. ## Current state of the code (`origin/main` at 310c6eb) - Presenting window. `Host::presenter` in `crates/victory-gpu/src/host.rs` uses `title_window()` (the first visible top-level window of the process) and otherwise `window(w, h)`, which starts a `victory-window` thread running `make_window` (class `VIctory`, `WS_OVERLAPPEDWINDOW | WS_VISIBLE`, default position) and a bare message pump; `window_proc` is `DefWindowProcW` only. Per #433, the title keeps its own windows hidden, so in practice the presenting window is ours (this is read from #433's description and `title_window`'s filter on visibility; not re-measured). - Swap chain. `IDXGISwapChain3`, `DXGI_SWAP_EFFECT_FLIP_DISCARD`, `BUFFERS = 2`, sized to the title's frame (`Width`/`Height` of the presented texture), made with `CreateSwapChainForHwnd`. `ResizeBuffers` is called when the presented size or format changes (after `settle_now(WHY_SYNC)`). Each present copies the title's texture into the back buffer (`CopyResource`) and calls `Present(0, 0)`. - Overlay precedent. #717 adds a copy of an upload buffer onto the back buffer inside `present`. That is the place an interactive menu would draw too. - Input. `crates/victory-hle/src/modules/gameinput.rs` polls `GetAsyncKeyState` for virtual keys `0x08..=0xFE` while the process has focus and hands them to the title as a keyboard device; the same keys drive the stand-in gamepad (`FALLBACK_BUTTONS`: Esc, Tab, Enter, Backspace, X, Y, arrows, Q, E, F, H, plus W/A/S/D, I/J/K/L, Z, C). There is no filter between the OS and the title: any key reaches it. A menu key would therefore also reach the title unless the input module is told to stop. - Config. `victory-core/src/config.rs` holds paths only (`game_dir`, `cache_dir`, `data_dir`, `test_titles`); display settings are not part of `Config` on main (#433 adds `[window]`). - Frame rate. `Present(0, 0)` has no limiter of its own. The only pacing is the title's own clock (`crates/victory-gpu/src/frame.rs`), which is a separate topic (see the frame pacing issue). ## Proposal, in deliverable phases 1. Window mode at run time, no menu. Alt+Enter and/or F11 toggle windowed / borderless fullscreen on the presenting window (style change plus `SetWindowPos` over the monitor the window is on; remember the windowed rectangle). Builds on #433 (start-up mode) and replaces #131. The swap chain keeps the title's size and the DXGI scaler stretches it (as #433 documents), so aspect handling is a decision to make here: either keep stretching or letterbox to the title's aspect ratio. Acceptance below. Small enough for one PR. 2. Frame-rate limiter. `[display] fps_limit` (0 = off) applied in `present` before `Present`, with a sleep-then-spin wait on a monotonic clock. No change to the title's frame clock. Also small enough for one PR. Effect is only visible when frames are faster than the limit; in the world today frames are far slower (many reports in this repository measure 0.4 to 5 fps), so this is useful in menus and videos first. Not verified for any other case. 3. Settings model. One `[display]` table in `victory.toml` (mode, size, vsync, fps_limit) with `VICTORY_*` overrides, parsed in `victory-core`, shared by `victory-gpu`. Coordinate with #433's `[window]` so there is one table, not two. 4. Menu. A key (proposal: F10; F3 is taken by #717, Esc/Tab/Enter are the title's) opens a text menu drawn like #717's panel (GDI into a bitmap, uploaded and copied onto the back buffer, no new dependency). Items: mode, resolution (list from the monitor, applied as window size, not as a title render size), vsync, fps limit, overlay on/off. Navigation by arrows/Enter/Esc while it is open. 5. Input capture. While the menu is open, `gameinput` hands the title an idle keyboard and pad (no keys, no stand-in pad), then returns to normal on close; the key that opened the menu is also masked. Needs a shared flag between `victory-gpu` (owner of the menu) and `victory-hle` (owner of input); the direction of that dependency is a design choice to make before coding. 6. Persistence. Changes made in the menu are written back to `victory.toml` only on an explicit "save". ## Risks and open points - Changing the swap chain size or style while presents are sent ahead (`late_free_present`) must go through `settle_now` the way `ResizeBuffers` already does; not tested. - Window style changes on a window whose message loop runs on its own thread (`victory-window`) must be marshalled to that thread or use `SetWindowPos`/`ShowWindow` that are safe cross-thread; not verified. - Exclusive fullscreen (`SetFullscreenState`) is not proposed: flip-model borderless is enough, and a mode switch on a device that can be removed is a new failure mode. - Resolution here means the window / output size. The title renders at its own size; render-resolution changes belong to the upscaling issue. - Linux/Proton: window styles and DPI behave differently there (see #131's motivation); not verified. - No licence issue: no third-party code. ## Acceptance criteria (measurable) - Phase 1: toggling twice returns to the same window rectangle (compare `GetWindowRect` before and after); no `device removed`, no swap-chain error in the log across 20 toggles in a run that reaches the first menu; the frame counter keeps increasing after each toggle. - Phase 2: with `fps_limit = 60` on a scene that exceeds 60 fps without the limit, the mean present interval over 10 s is 16.7 ms +/- 1 ms and the standard deviation is below 1 ms (from the present timestamps #717/`bench.ps1` already record); with `0` the interval is unchanged from main. - Phases 3 to 5: with the menu open, 10 s of key presses produce no change in the title's input (compare the stand-in pad's readings or a test with a recorded input log); closing the menu restores input within 2 frames. - `cargo test --workspace --locked` stays green; each phase adds a unit test for its parsing and state machine. ## Not verified - Which window the presenting path uses on a given host (title window vs `victory-window`) beyond #433's statement. - Behaviour of `ResizeBuffers` after a style change while presents are in flight. - Any behaviour under Proton/Wine. ## Next step Phases 1 and 2 are simple and independent of the title. If there is no objection, a PR for phase 1 (stacked on #433 if it is merged first, otherwise rebased on `main`) and a separate PR for phase 2 will follow.
Revens2 commented 2026-11-25 06:06:40 +00:00 (Migrated from github.com)
Author
Contributor

Imported from fxceless/victory-fork. Originally posted by Revens2 on 2026-11-25T05:48:37Z.


Sibling issues opened together: #727 (settings/menu), #728 (frame pacing and latency), #729 (Reflex), #730 (upscaling), #731 (frame generation). Overlaps are named in each body; this set should stay split by subject.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7154159627 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/issues/727#issuecomment-7154159627). Originally posted by [Revens2](https://github.com/Revens2) on 2026-11-25T05:48:37Z. --- Sibling issues opened together: #727 (settings/menu), #728 (frame pacing and latency), #729 (Reflex), #730 (upscaling), #731 (frame generation). Overlaps are named in each body; this set should stay split by subject.
AwkGrep256 commented 2026-11-27 12:50:01 +00:00 (Migrated from github.com)
Author
Contributor

Imported from fxceless/victory-fork. Originally posted by AwkGrep256 on 2026-11-27T12:50:01Z.


@Revens2 I saw CernyMuzCZ’s borderless and FPS cap commit linked here. I’ve been working on the menu side upstream. The draft adds VIctory controls to the game’s own Settings → Graphics tab, using its existing keyboard and controller navigation. I’ve tested changing the Upscaler there, saving to victory.toml, and launching with AMD FSR on the next run.

Would you be up for trying the FPS cap as a first shared setting? Your code could handle applying the cap live, and I can help wire up the native row. The same settings API could host window mode once we’ve tested how that behaves from the menu.

Prototype PR · Design discussion

<!-- greyfinch-sync:fxceless/victory-fork:comment:7218728565 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/issues/727#issuecomment-7218728565). Originally posted by [AwkGrep256](https://github.com/AwkGrep256) on 2026-11-27T12:50:01Z. --- @Revens2 I saw CernyMuzCZ’s borderless and FPS cap commit linked here. I’ve been working on the menu side upstream. The draft adds VIctory controls to the game’s own **Settings → Graphics** tab, using its existing keyboard and controller navigation. I’ve tested changing the Upscaler there, saving to `victory.toml`, and launching with AMD FSR on the next run. Would you be up for trying the FPS cap as a first shared setting? Your code could handle applying the cap live, and I can help wire up the native row. The same settings API could host window mode once we’ve tested how that behaves from the menu. [Prototype PR](https://github.com/Marvisak/VIctory/pull/2863) · [Design discussion](https://github.com/Marvisak/VIctory/issues/2862)
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork#727
No description provided.