Window: VICTORY_CAPTION sets the window caption #434

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

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


Depends on "Window: configurable size ([window] size) ..." (it changes make_window() and the CreateWindowEx hooks as that PR leaves them); review after it, or this PR's diff also shows that one's commits.

VICTORY_CAPTION=<text> replaces the caption of the window victory-gpu presents in (default VIctory) and of the title's own top-level windows when they are created, e.g. to show a neutral caption while the screen is shared. A window the title creates with CreateWindowExA gets the caption converted to the ANSI code page, as that call expects. The frame meter appended to the caption no longer adds the project's name itself; it follows whatever the caption is (our window reads "VIctory | N fps ..." instead of "VIctory | VIctory N fps ...").

Limitation: text the title sets on its own windows later is not replaced; those windows are kept hidden by the title, so the caption on screen is the one of the presenting window.

README: the variable is added to the environment table.

Testing: unit test for the ANSI conversion; cargo test (WARP) and clippy pass for victory-gpu and victory-hle. 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:6594541327 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/434). Originally posted by [sennecools](https://github.com/sennecools) on 2026-11-25T00:49:07Z. --- Depends on "Window: configurable size ([window] size) ..." (it changes make_window() and the CreateWindowEx hooks as that PR leaves them); review after it, or this PR's diff also shows that one's commits. `VICTORY_CAPTION=<text>` replaces the caption of the window victory-gpu presents in (default `VIctory`) and of the title's own top-level windows when they are created, e.g. to show a neutral caption while the screen is shared. A window the title creates with CreateWindowExA gets the caption converted to the ANSI code page, as that call expects. The frame meter appended to the caption no longer adds the project's name itself; it follows whatever the caption is (our window reads "VIctory | N fps ..." instead of "VIctory | VIctory N fps ..."). Limitation: text the title sets on its own windows later is not replaced; those windows are kept hidden by the title, so the caption on screen is the one of the presenting window. README: the variable is added to the environment table. Testing: unit test for the ANSI conversion; `cargo test` (WARP) and clippy pass for victory-gpu and victory-hle. 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:11:49 +00:00 (Migrated from github.com)

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

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d39096b88a

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:fxceless/victory-fork:review:6049880733 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/434#pullrequestreview-6049880733). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T00:53:37Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `d39096b88a` <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". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
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:53:41Z.


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:53:39.842609Z d39096b 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:7148998414 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/434#issuecomment-7148998414). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T00:53:41Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"d39096b88ab582ed973d562ae3cd150f4cc5c56e","has_any_findings":true,"has_unresolved_findings":true,"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:53:39.842609Z">2026-11-25T00:53:39.842609Z</relative-time> | `d39096b` | 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>
chatgpt-codex-connector[bot commented 2026-11-25 01:12:10 +00:00 (Migrated from github.com)

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

Code review location: crates/victory-hle/src/modules/lifecycle.rs; line 404

@@ -332,19 +392,17 @@ mod tests {
     }
 
     #[test]
-    fn oversized_windows_shrink_to_the_screen() {
-        let area = RECT {
-            left: 0,
-            top: 0,
-            right: 1920,
-            bottom: 1040,
-        };
-        assert_eq!(fit_into(&area, 3840, 2160), (1848, 1040));
-        assert_eq!(fit_into(&area, 1280, 720), (1280, 720));
-        assert_eq!(
-            fit_into(&area, wm::CW_USEDEFAULT, 0),
-            (wm::CW_USEDEFAULT, 0)
-        );
+    fn an_ansi_caption_is_in_the_code_page_and_terminated() {
+        assert_eq!(ansi("Neutral caption"), b"Neutral caption\0");
+        assert_eq!(ansi("a\0b"), b"ab\0");
+        assert_eq!(ansi(""), b"\0");
+        // Not passed on as UTF-8 bytes (unless the code page is UTF-8):
+        // one byte per character, whatever the code page makes of it.
+        use windows_sys::Win32::Globalization::{CP_UTF8, GetACP};
+        // SAFETY: a plain query.
+        if unsafe { GetACP() } != CP_UTF8 {
+            assert_eq!(ansi("caf\u{e9}").len(), 5);

P2 Badge Remove the single-byte assumption from the ANSI caption test

On a Windows system using ACP 936 (Simplified Chinese), é encodes as two bytes (A8 A6), so the correctly converted café plus its terminator has length 6, not 5. The guard excludes only UTF-8 and therefore runs this invalid assertion for multibyte ANSI code pages, causing the victory-hle test suite to fail on those hosts. Restrict the fixed-length assertion to a known single-byte code page or compare against the expected encoding for the actual code page.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:fxceless/victory-fork:review-comment:4688703074 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/434#discussion_r4688703074). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T00:53:37Z. **Code review location:** `crates/victory-hle/src/modules/lifecycle.rs`; line 404 ~~~~diff @@ -332,19 +392,17 @@ mod tests { } #[test] - fn oversized_windows_shrink_to_the_screen() { - let area = RECT { - left: 0, - top: 0, - right: 1920, - bottom: 1040, - }; - assert_eq!(fit_into(&area, 3840, 2160), (1848, 1040)); - assert_eq!(fit_into(&area, 1280, 720), (1280, 720)); - assert_eq!( - fit_into(&area, wm::CW_USEDEFAULT, 0), - (wm::CW_USEDEFAULT, 0) - ); + fn an_ansi_caption_is_in_the_code_page_and_terminated() { + assert_eq!(ansi("Neutral caption"), b"Neutral caption\0"); + assert_eq!(ansi("a\0b"), b"ab\0"); + assert_eq!(ansi(""), b"\0"); + // Not passed on as UTF-8 bytes (unless the code page is UTF-8): + // one byte per character, whatever the code page makes of it. + use windows_sys::Win32::Globalization::{CP_UTF8, GetACP}; + // SAFETY: a plain query. + if unsafe { GetACP() } != CP_UTF8 { + assert_eq!(ansi("caf\u{e9}").len(), 5); ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Remove the single-byte assumption from the ANSI caption test** On a Windows system using ACP 936 (Simplified Chinese), `é` encodes as two bytes (`A8 A6`), so the correctly converted `café` plus its terminator has length 6, not 5. The guard excludes only UTF-8 and therefore runs this invalid assertion for multibyte ANSI code pages, causing the `victory-hle` test suite to fail on those hosts. Restrict the fixed-length assertion to a known single-byte code page or compare against the expected encoding for the actual code page. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
sennecools commented 2026-11-25 02:09:33 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by sennecools on 2026-11-25T02:05:25Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:fxceless/victory-fork:review:6050551952 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/434#pullrequestreview-6050551952). Originally posted by [sennecools](https://github.com/sennecools) on 2026-11-25T02:05:25Z. **Review:** COMMENTED --- _No description provided._
sennecools commented 2026-11-25 02:10:15 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by sennecools on 2026-11-25T02:05:25Z.

Code review location: crates/victory-hle/src/modules/lifecycle.rs; line 404

@@ -332,19 +392,17 @@ mod tests {
     }
 
     #[test]
-    fn oversized_windows_shrink_to_the_screen() {
-        let area = RECT {
-            left: 0,
-            top: 0,
-            right: 1920,
-            bottom: 1040,
-        };
-        assert_eq!(fit_into(&area, 3840, 2160), (1848, 1040));
-        assert_eq!(fit_into(&area, 1280, 720), (1280, 720));
-        assert_eq!(
-            fit_into(&area, wm::CW_USEDEFAULT, 0),
-            (wm::CW_USEDEFAULT, 0)
-        );
+    fn an_ansi_caption_is_in_the_code_page_and_terminated() {
+        assert_eq!(ansi("Neutral caption"), b"Neutral caption\0");
+        assert_eq!(ansi("a\0b"), b"ab\0");
+        assert_eq!(ansi(""), b"\0");
+        // Not passed on as UTF-8 bytes (unless the code page is UTF-8):
+        // one byte per character, whatever the code page makes of it.
+        use windows_sys::Win32::Globalization::{CP_UTF8, GetACP};
+        // SAFETY: a plain query.
+        if unsafe { GetACP() } != CP_UTF8 {
+            assert_eq!(ansi("caf\u{e9}").len(), 5);

Good catch: the length check assumed a single-byte ANSI code page and failed on double-byte ones such as 936.
The encoder now takes its code page, and a new test checks the exact bytes for 1252, 936 and UTF-8 on any machine.
The length check on the active code page now runs only when that code page is single-byte.

AI-assisted.

<!-- greyfinch-sync:fxceless/victory-fork:review-comment:4689275925 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/434#discussion_r4689275925). Originally posted by [sennecools](https://github.com/sennecools) on 2026-11-25T02:05:25Z. **Code review location:** `crates/victory-hle/src/modules/lifecycle.rs`; line 404 ~~~~diff @@ -332,19 +392,17 @@ mod tests { } #[test] - fn oversized_windows_shrink_to_the_screen() { - let area = RECT { - left: 0, - top: 0, - right: 1920, - bottom: 1040, - }; - assert_eq!(fit_into(&area, 3840, 2160), (1848, 1040)); - assert_eq!(fit_into(&area, 1280, 720), (1280, 720)); - assert_eq!( - fit_into(&area, wm::CW_USEDEFAULT, 0), - (wm::CW_USEDEFAULT, 0) - ); + fn an_ansi_caption_is_in_the_code_page_and_terminated() { + assert_eq!(ansi("Neutral caption"), b"Neutral caption\0"); + assert_eq!(ansi("a\0b"), b"ab\0"); + assert_eq!(ansi(""), b"\0"); + // Not passed on as UTF-8 bytes (unless the code page is UTF-8): + // one byte per character, whatever the code page makes of it. + use windows_sys::Win32::Globalization::{CP_UTF8, GetACP}; + // SAFETY: a plain query. + if unsafe { GetACP() } != CP_UTF8 { + assert_eq!(ansi("caf\u{e9}").len(), 5); ~~~~ --- Good catch: the length check assumed a single-byte ANSI code page and failed on double-byte ones such as 936. The encoder now takes its code page, and a new test checks the exact bytes for 1252, 936 and UTF-8 on any machine. The length check on the active code page now runs only when that code page is single-byte. AI-assisted.
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/434:upstream-pr/434'
git switch 'upstream-pr/434'

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/434'
git switch 'upstream-pr/434'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/434'
git switch 'upstream-pr/434'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/434'
git switch 'main'
git merge --squash 'upstream-pr/434'
git switch 'main'
git merge --ff-only 'upstream-pr/434'
git switch 'main'
git merge 'upstream-pr/434'
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!434
No description provided.