Window: configurable size ([window] size) for the window VIctory presents in; closing it ends the title #433

Open
github-bot wants to merge 2 commits from github-bot/gh-433 into main AGit
Owner

@⁠sennecools on GitHub · 2026-11-25 00:49 UTC · original
sennecools:contrib/window-size → main · +1021 −88 · 15 files · 2 commits · open

The title keeps its own top-level windows hidden, so the window on screen is the one victory-gpu creates to present in, sized to the frame (3840x2160 for a 4K title) and placed by Windows; on a 4K screen it does not fit.

This adds [window] size in victory.toml (or VICTORY_WINDOW_SIZE), applied to that window:

  • title (default): a client area of the frame's size, now shrunk to the primary screen's work area if larger (keeping proportions) and centred. Before, this window was not fitted at all; only the title's own windows were.
  • <width>x<height> (each side 64 to 16384): that client area, centred, shrunk to the work area if it does not fit.
  • fullscreen: a borderless popup over the primary screen (Alt+F4 and the taskbar still close it).

The title still renders at its own size and the swap chain stretches the frame to the window, so another aspect ratio distorts the picture. The title's own top-level windows keep only the existing shrink-to-the-screen fit (the code moved from lifecycle.rs to victory_gpu:🪟:place, same behaviour), since a title may read back its client size or styles.

Other changes:

  • victory makes the process per-monitor DPI aware (V2) before any window exists, so sizes are physical pixels; on a screen scaled to 150 % a 1920x1080 window is no longer enlarged by Windows. This applies in every mode. A window moved to a screen with another scale keeps its size in pixels.
  • The client size is estimated with AdjustWindowRectExForDpi and corrected after creation if the real frame differs; the window is shown only once placed.
  • Closing the presenting window (close button, Alt+F4, taskbar) now ends the title through the same suspend path as closing the title's window; before, the window was destroyed and the title ran on without one. Its window menu via Alt/F10 is ignored, so the keyboard pad cannot drive it (the mouse still opens it).
  • victory config and the run header print the window size; README and victory.example.toml document the key.

Relation to "HLE: add a configurable maximum title window size": that PR caps the title's own top-level windows via VICTORY_WINDOW_MAX; since the title keeps those hidden, it does not change the window you see. Both PRs touch fit() in lifecycle.rs, so whichever merges second needs a rebase; this one covers what that cap is for.

Testing: unit tests for config parsing (env over file, errors name their source, the example's value parses) and for the placement as pure functions per mode (4K frame on a 4K work area, pixel sizes, too-large sizes, fullscreen, unknown screen, a larger real frame, close and key-menu handling). cargo test (WARP) and clippy pass for victory-core, victory-gpu, victory-hle and victory. Not verified in a title run on this branch.

This change has also been part of our local combined build, which ran the title in the game on an RX 9070 XT (D3D12, Windows 11) several times tonight without problems from it.

AI-assisted.

**@⁠sennecools** on GitHub · 2026-11-25 00:49 UTC · [original](https://github.com/fxceless/victory-fork/pull/433) `sennecools:contrib/window-size` → `main` · +1021 −88 · 15 files · 2 commits · open The title keeps its own top-level windows hidden, so the window on screen is the one victory-gpu creates to present in, sized to the frame (3840x2160 for a 4K title) and placed by Windows; on a 4K screen it does not fit. This adds `[window] size` in victory.toml (or `VICTORY_WINDOW_SIZE`), applied to that window: - `title` (default): a client area of the frame's size, now shrunk to the primary screen's work area if larger (keeping proportions) and centred. Before, this window was not fitted at all; only the title's own windows were. - `<width>x<height>` (each side 64 to 16384): that client area, centred, shrunk to the work area if it does not fit. - `fullscreen`: a borderless popup over the primary screen (Alt+F4 and the taskbar still close it). The title still renders at its own size and the swap chain stretches the frame to the window, so another aspect ratio distorts the picture. The title's own top-level windows keep only the existing shrink-to-the-screen fit (the code moved from lifecycle.rs to victory_gpu::window::place, same behaviour), since a title may read back its client size or styles. Other changes: - victory makes the process per-monitor DPI aware (V2) before any window exists, so sizes are physical pixels; on a screen scaled to 150 % a 1920x1080 window is no longer enlarged by Windows. This applies in every mode. A window moved to a screen with another scale keeps its size in pixels. - The client size is estimated with AdjustWindowRectExForDpi and corrected after creation if the real frame differs; the window is shown only once placed. - Closing the presenting window (close button, Alt+F4, taskbar) now ends the title through the same suspend path as closing the title's window; before, the window was destroyed and the title ran on without one. Its window menu via Alt/F10 is ignored, so the keyboard pad cannot drive it (the mouse still opens it). - `victory config` and the run header print the window size; README and victory.example.toml document the key. Relation to "HLE: add a configurable maximum title window size": that PR caps the title's own top-level windows via `VICTORY_WINDOW_MAX`; since the title keeps those hidden, it does not change the window you see. Both PRs touch `fit()` in lifecycle.rs, so whichever merges second needs a rebase; this one covers what that cap is for. Testing: unit tests for config parsing (env over file, errors name their source, the example's value parses) and for the placement as pure functions per mode (4K frame on a 4K work area, pixel sizes, too-large sizes, fullscreen, unknown screen, a larger real frame, close and key-menu handling). `cargo test` (WARP) and clippy pass for victory-core, victory-gpu, victory-hle and victory. Not verified in a title run on this branch. This change has also been part of our local combined build, which ran the title in the game on an RX 9070 XT (D3D12, Windows 11) several times tonight without problems from it. AI-assisted.
A console title sizes its window to its render target, which on a 4K screen fills the whole screen. [window] size in victory.toml, or VICTORY_WINDOW_SIZE, now chooses the window instead: "title" (the default, as before: the title's size shrunk to the work area), "<width>x<height>" (a client area of that size, centred, shrunk to the work area if it does not fit), or "fullscreen" (borderless over the primary screen). Only the window changes; the title renders at its own size and the swap chain stretches the frame to the window.

victory now makes itself per-monitor DPI aware before any window exists, so sizes are physical pixels: on a screen scaled to 150 %, 1920x1080 is a quarter of a 4K screen, not 2880x1620. The client size is estimated with AdjustWindowRectExForDpi and corrected after creation if the real frame differs. The placement is a pure function, tested per mode without a screen.

(cherry picked from commit 3ec3bc906c17d45438a8ec411551a150a86b0a16)

AI-assisted (Claude Code)
The title keeps its own windows hidden, so the window on screen is the one victory-gpu makes to present to, sized to the frame (3840x2160 for this title) and placed by Windows. The placement moves to victory-gpu's window module: in "title" mode that window is now fitted to the work area and centred, "<width>x<height>" sets its client area, "fullscreen" makes it a borderless popup over the primary screen. It is created hidden and shown once its client size is right. The title's own windows only keep the existing shrink-to-the-screen fit: the title may read back its client size or styles, so they are not resized or restyled.

Closing that window (close button, Alt+F4, the taskbar) now ends the title through the same suspend path as closing the title's window, via a callback victory-hle registers; before, the window was destroyed and the title ran on without one. The window menu (Alt, F10) is ignored, so the keyboard pad cannot drive it.

(cherry picked from commit f036d84e77868a3b14850157e502377c70aee7a9)

AI-assisted (Claude Code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:43:12 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-25 00:49 UTC · original · edited 2026-11-25 00:54 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T00:54:02.509632Z 2861612 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-25 00:49 UTC · [original](https://github.com/fxceless/victory-fork/pull/433#issuecomment-7148911926) · edited 2026-11-25 00:54 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"28616122038ff743bed6ef5f8e1596c6e86c9043","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-25T00:54:02.509632Z">2026-11-25T00:54:02.509632Z</relative-time> | `2861612` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/Cargo.toml
  • crates/victory-gpu/src/lib.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/433/head:github-bot/gh-433'
git switch 'github-bot/gh-433'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-433'
git switch 'github-bot/gh-433'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-433'
git switch 'github-bot/gh-433'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-433'
git switch 'main'
git merge --squash 'github-bot/gh-433'
git switch 'main'
git merge --ff-only 'github-bot/gh-433'
git switch 'main'
git merge 'github-bot/gh-433'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.