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

Open
sennecools wants to merge 2 commits from upstream-pr/433 into main
sennecools commented 2026-11-25 00:49:02 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by sennecools on 2026-11-25T00:49:02Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6594540330 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/433). Originally posted by [sennecools](https://github.com/sennecools) on 2026-11-25T00:49:02Z. --- 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.
chatgpt-codex-connector[bot commented 2026-11-25 01:12:05 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T00:49:14Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7148911926 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/433#issuecomment-7148911926). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T00:49:14Z. --- <!-- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/433:upstream-pr/433'
git switch 'upstream-pr/433'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/433'
git switch 'upstream-pr/433'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/433'
git switch 'upstream-pr/433'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/433'
git switch 'main'
git merge --squash 'upstream-pr/433'
git switch 'main'
git merge --ff-only 'upstream-pr/433'
git switch 'main'
git merge 'upstream-pr/433'
git push origin 'main'
Sign in to join this conversation.
No reviewers
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!433
No description provided.