Keep the first setting in UTF-8 files with a BOM #4795

Open
andrewpozdnakov7-jpg wants to merge 1 commit from upstream-pr/4795 into main
andrewpozdnakov7-jpg commented 2026-12-01 08:55:11 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-12-01T08:55:11Z.


What it changes

Windows PowerShell can write a UTF-8 byte-order mark at the very start of victory-settings.txt. When the file starts directly with a setting, victory play skips that setting. Saving another option from F1 also drops the untouched first setting from disk.

Both readers now skip one leading BOM before splitting the lines. A settings file without a BOM follows the same parsing rules.

How it was tested

  • GPU and profile: the settings checks use a synthetic file with CRLF line endings. In-game testing is pending.
  • Before: the exact parsers from v2026.11.30.03 and main 5fabb46e skipped a first-line 60 FPS cap. The Windows/MSVC regression saw 33,333 µs instead of 16,667 µs. The original F1 save methods also removed that line when saving a different DLSS setting.
  • After: b27bb496629842ad794e0caa31dc626066ed1f63 applied the 16,667 µs cap with and without a BOM. An isolated check of the F1 save method kept the first line while updating the other setting in both files.
  • cargo test --offline --locked --jobs 2 -p victory: 92 unit and 3 integration tests passed on Windows x64 / MSVC. cargo xtask policy --staged passed for both files.
  • CI on main has five existing Clippy errors. Main CI / check · Shared lint fix #4707

Checked for overlap

  • I searched issues and PRs for the symptom and reviewed open PRs touching the same files. Related: #4631 changes quoted command-line arguments. #4764 and #4711 change the F1 interface.

Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the change into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5582333381 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4795). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-12-01T08:55:11Z. --- ## What it changes Windows PowerShell can write a UTF-8 byte-order mark at the very start of `victory-settings.txt`. When the file starts directly with a setting, `victory play` skips that setting. Saving another option from F1 also drops the untouched first setting from disk. Both readers now skip one leading BOM before splitting the lines. A settings file without a BOM follows the same parsing rules. ## How it was tested - GPU and profile: the settings checks use a synthetic file with CRLF line endings. In-game testing is pending. - Before: the exact parsers from `v2026.11.30.03` and `main` `5fabb46e` skipped a first-line 60 FPS cap. The Windows/MSVC regression saw 33,333 µs instead of 16,667 µs. The original F1 save methods also removed that line when saving a different DLSS setting. - After: `b27bb496629842ad794e0caa31dc626066ed1f63` applied the 16,667 µs cap with and without a BOM. An isolated check of the F1 save method kept the first line while updating the other setting in both files. - `cargo test --offline --locked --jobs 2 -p victory`: 92 unit and 3 integration tests passed on Windows x64 / MSVC. `cargo xtask policy --staged` passed for both files. - CI on `main` has five existing Clippy errors. [Main CI / check](https://github.com/trustno1-coder/VIctory-NVIDIA/actions/runs/46563306780/job/142355972539) · [Shared lint fix #4707](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4707) ## Checked for overlap - [x] I searched issues and PRs for the symptom and reviewed open PRs touching the same files. Related: #4631 changes quoted command-line arguments. #4764 and #4711 change the F1 interface. Please retain the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the change into another commit. AI-assisted with OpenAI Codex.
cloph-dsp commented 2026-12-01 12:38:31 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by cloph-dsp on 2026-12-01T12:38:31Z.


Verification of this PR (AI-assisted: Hy4 flash), source only, no game data.

Windows / rustc 1.100.0 / MSVC. Worktree at head b27bb496, dedicated per-worktree CARGO_TARGET_DIR (D:\Victory-Contrib\NVIDIA-Contrib\target-4795), never shared.

Negative control on base 5fabb46e:

  • git grep -F menu_file_bom_keeps_the_first_setting 5fabb46e -- . -> exit 1 (test is new)
    Whitespace: git diff --check 5fabb46e..b27bb496 -> exit 0, clean.
cargo test --locked -p victory --bin victory -- play::tests::menu_file_bom_keeps_the_first_setting --exact --test-threads=1

-> test play::tests::menu_file_bom_keeps_the_first_setting ... ok / test result: ok. 1 passed; 0 failed; 91 filtered out.

Note for the author: the test lives in the binary crate apps/victory/src/play.rs, so it needs -p victory --bin victory and the play::tests:: prefix; -p victory-gpu --lib gives running 0 tests (a false negative, not a failure).

GPU/driver: N/A (file-parsing test, no device).

Verdict: PASS for the new synthetic test on this host.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7311432528 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4795#issuecomment-7311432528). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-12-01T12:38:31Z. --- Verification of this PR (AI-assisted: Hy4 flash), source only, no game data. Windows / rustc 1.100.0 / MSVC. Worktree at head b27bb496, dedicated per-worktree CARGO_TARGET_DIR (D:\Victory-Contrib\NVIDIA-Contrib\target-4795), never shared. Negative control on base 5fabb46e: - `git grep -F menu_file_bom_keeps_the_first_setting 5fabb46e -- .` -> exit 1 (test is new) Whitespace: `git diff --check 5fabb46e..b27bb496` -> exit 0, clean. ``` cargo test --locked -p victory --bin victory -- play::tests::menu_file_bom_keeps_the_first_setting --exact --test-threads=1 ``` -> `test play::tests::menu_file_bom_keeps_the_first_setting ... ok` / `test result: ok. 1 passed; 0 failed; 91 filtered out`. Note for the author: the test lives in the binary crate `apps/victory/src/play.rs`, so it needs `-p victory --bin victory` and the `play::tests::` prefix; `-p victory-gpu --lib` gives `running 0 tests` (a false negative, not a failure). GPU/driver: N/A (file-parsing test, no device). Verdict: PASS for the new synthetic test on this host.
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/4795:upstream-pr/4795'
git switch 'upstream-pr/4795'

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