HLE: report the host's commit headroom before the title starts #224

Open
WallasSCRIPTS wants to merge 1 commit from upstream-pr/224 into main
WallasSCRIPTS commented 2026-11-24 01:35:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by WallasSCRIPTS on 2026-11-24T01:35:58Z.


Completes the startup check #23 asks for, on top of #51's failure message.

What

XMemAllocatePhysicalPages reserves a pagefile-backed section, and map commits its view in one VirtualAlloc. On its first boot the title asks for 99,776 64 KiB pages (6.1 GiB) in one call. When Windows cannot commit that, the mapping fails, the title gets a null back, and it stops on a breakpoint that reads like a title crash.

#51 now names the limit when the commit fails. This adds the check that runs before it:

  • xmem::commit_headroom() reads K32GetPerformanceInfo and returns what Windows can still commit and the commit limit, in bytes.
  • victory run prints both in the startup block, next to the 6.1 GiB the first boot asks for, and adds a second line when the headroom is short of it.
build          unknown (b99f876b...)
mapped at      0x... (preferred 0x...)
title          7952987A, storage ... (1024 MB)
console        Xbox Series X
commit         21.4 GiB available of 44.0 GiB (first boot asks 6.1 GiB)

Since bug reports paste the startup block, every one of them now carries the host's commit state beside the build hash and the console mode.

Verification

Windows 11 x64, AMD RX 7600, Rust 1.98.1 (the pinned toolchain).

  • cargo test --workspace: 265 passed, 0 failed, 4 ignored (264 before this change; the new test is in victory-hle).
  • cargo clippy -p victory-hle -p victory --all-targets: clean.
  • rustfmt --edition 2024 --check on both touched files: clean.

One honest gap: this host has no title dump, so I could not run victory run against the game. The line prints after binding and before the title starts, so seeing it needs a real run; the numbers behind it are covered by commit_headroom_is_within_the_limit.

Note

The PERFORMANCE_INFORMATION initializer in commit is fixed here as clippy asks (field assignment outside Default::default()), since it is the same struct and its warning was the crate's only one. Say the word if you would rather keep that out of this PR.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6572603664 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/224). Originally posted by [WallasSCRIPTS](https://github.com/WallasSCRIPTS) on 2026-11-24T01:35:58Z. --- Completes the startup check #23 asks for, on top of #51's failure message. ## What `XMemAllocatePhysicalPages` reserves a pagefile-backed section, and `map` commits its view in one `VirtualAlloc`. On its first boot the title asks for 99,776 64 KiB pages (6.1 GiB) in one call. When Windows cannot commit that, the mapping fails, the title gets a null back, and it stops on a breakpoint that reads like a title crash. #51 now names the limit when the commit fails. This adds the check that runs before it: - `xmem::commit_headroom()` reads `K32GetPerformanceInfo` and returns what Windows can still commit and the commit limit, in bytes. - `victory run` prints both in the startup block, next to the 6.1 GiB the first boot asks for, and adds a second line when the headroom is short of it. ``` build unknown (b99f876b...) mapped at 0x... (preferred 0x...) title 7952987A, storage ... (1024 MB) console Xbox Series X commit 21.4 GiB available of 44.0 GiB (first boot asks 6.1 GiB) ``` Since bug reports paste the startup block, every one of them now carries the host's commit state beside the build hash and the console mode. ## Verification Windows 11 x64, AMD RX 7600, Rust 1.98.1 (the pinned toolchain). - `cargo test --workspace`: **265 passed, 0 failed, 4 ignored** (264 before this change; the new test is in `victory-hle`). - `cargo clippy -p victory-hle -p victory --all-targets`: clean. - `rustfmt --edition 2024 --check` on both touched files: clean. One honest gap: this host has no title dump, so I could not run `victory run` against the game. The line prints after binding and before the title starts, so seeing it needs a real run; the numbers behind it are covered by `commit_headroom_is_within_the_limit`. ## Note The `PERFORMANCE_INFORMATION` initializer in `commit` is fixed here as clippy asks (field assignment outside `Default::default()`), since it is the same struct and its warning was the crate's only one. Say the word if you would rather keep that out of this PR.
jeremygold02 commented 2026-11-24 06:56:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T05:22:32Z.


Thanks @WallasSCRIPTS for reporting host commit headroom before the title starts.

I tested commit b87a9682e3462491bed43e99d91fcc51b39ba7a9 with:

cargo test --locked -p victory-hle --lib commit_headroom_is_within_the_limit -- --test-threads=1
cargo check --locked -p victory

The targeted HLE test passed (1 passed, 0 failed; 86 filtered). commit_headroom_is_within_the_limit verifies that the host query returns a nonzero commit limit and that available commit does not exceed that limit. The app compile check succeeded and includes the startup report_commit path.

There is no test here for the printed values or the low-headroom warning branch, and I did not launch a title.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7122887858 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/224#issuecomment-7122887858). Originally posted by [jeremygold02](https://github.com/jeremygold02) on 2026-11-24T05:22:32Z. --- Thanks @WallasSCRIPTS for reporting host commit headroom before the title starts. I tested commit `b87a9682e3462491bed43e99d91fcc51b39ba7a9` with: ``` cargo test --locked -p victory-hle --lib commit_headroom_is_within_the_limit -- --test-threads=1 cargo check --locked -p victory ``` The targeted HLE test passed (1 passed, 0 failed; 86 filtered). [`commit_headroom_is_within_the_limit`](https://github.com/Marvisak/VIctory/blob/b87a9682e3462491bed43e99d91fcc51b39ba7a9/crates/victory-hle/src/modules/xmem.rs#L1050) verifies that the host query returns a nonzero commit limit and that available commit does not exceed that limit. The app compile check succeeded and includes the startup [`report_commit`](https://github.com/Marvisak/VIctory/blob/b87a9682e3462491bed43e99d91fcc51b39ba7a9/apps/victory/src/run.rs#L138) path. There is no test here for the printed values or the low-headroom warning branch, and I did not launch a title.
mercuryVM commented 2026-11-24 09:31:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T09:31:12Z.

Review: APPROVED


Tested b87a968 on Windows 11, RTX 5070, MSVC: the workspace passes. On the first full run the victory-hle lib binary exited with 0xc0000005. Two re-runs passed (87/87), as did its base commit, and commit_headroom_is_within_the_limit passes on its own. So it's an intermittent crash that this change didn't introduce, but someone should look at it separately.

  • CommitLimit - CommitTotal (in pages) × PageSize is the commit headroom Windows reports, and the PageSize == 0 guard covers a failed query. Printing it next to the 6.1 GiB first-boot mapping (issue #23) turns a confusing title breakpoint into an actionable line.
  • The PERFORMANCE_INFORMATION struct-update hunk is the same as #405, which is already in our fork. It merges cleanly.

No issues found in the change.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6036728597 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/224#pullrequestreview-6036728597). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T09:31:12Z. **Review:** APPROVED --- Tested b87a968 on Windows 11, RTX 5070, MSVC: the workspace passes. On the first full run the `victory-hle` lib binary exited with `0xc0000005`. Two re-runs passed (87/87), as did its base commit, and `commit_headroom_is_within_the_limit` passes on its own. So it's an intermittent crash that this change didn't introduce, but someone should look at it separately. - `CommitLimit - CommitTotal` (in pages) × `PageSize` is the commit headroom Windows reports, and the `PageSize == 0` guard covers a failed query. Printing it next to the 6.1 GiB first-boot mapping (issue #23) turns a confusing title breakpoint into an actionable line. - The `PERFORMANCE_INFORMATION` struct-update hunk is the same as #405, which is already in our fork. It merges cleanly. No issues found in the change. AI-assisted (Claude Code).
BaggyALPHA commented 2026-11-24 16:05:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BaggyALPHA on 2026-11-24T15:27:31Z.


Live startup verification on b87a968, title v1.0.2.1, using the diagnostics profile and WARP. The commit line printed in the startup block in both Series X and Series S modes.

One mode-specific mismatch showed up. The preflight says “first boot asks 6.1 GiB” in both modes, but the corresponding large physical-page request was 99,776 × 64 KiB (6.1 GiB) in Series X mode and 63,632 × 64 KiB (3.9 GiB) in Series S mode. The cutoff uses the same constant, so Series S can receive the short-headroom warning even when that particular mapping fits.

Could the reference size use the selected console mode, or be labeled explicitly as a Series X example? I'd also keep it clear that this describes one mapping. Overall startup can commit more memory. I verified the normal startup line and did not force the low-headroom branch.

AI-assisted test execution and write-up (OpenAI Codex).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7136059871 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/224#issuecomment-7136059871). Originally posted by [BaggyALPHA](https://github.com/BaggyALPHA) on 2026-11-24T15:27:31Z. --- Live startup verification on `b87a968`, title v1.0.2.1, using the diagnostics profile and WARP. The commit line printed in the startup block in both Series X and Series S modes. One mode-specific mismatch showed up. The preflight says **“first boot asks 6.1 GiB”** in both modes, but the corresponding large physical-page request was **99,776 × 64 KiB (6.1 GiB)** in Series X mode and **63,632 × 64 KiB (3.9 GiB)** in Series S mode. The cutoff uses the same constant, so Series S can receive the short-headroom warning even when that particular mapping fits. Could the reference size use the selected console mode, or be labeled explicitly as a Series X example? I'd also keep it clear that this describes one mapping. Overall startup can commit more memory. I verified the normal startup line and did not force the low-headroom branch. AI-assisted test execution and write-up (OpenAI Codex).
Marvisak commented 2026-11-25 01:07:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:21:43Z.


Automated triage for the maintainers.

Needs rebase. main has moved, and this branch now conflicts with it in README.md. It will be reviewed again once it is rebased.

The points from the earlier review still apply. FIRST_BOOT_BYTES in apps/victory/src/run.rs is the Series X figure. In Series S mode the same request is 63,632 × 64 KiB (3.9 GiB), so the size should come from victory_hle::console::current(), or the line should be labelled as the Series X case. The README sentence should match, and say it is one mapping.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148429018 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/224#issuecomment-7148429018). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:21:43Z. --- <!-- victory-triage v1 head=b87a9682e3462491bed43e99d91fcc51b39ba7a9 verdict=needs-rebase at=2026-11-25T18:25:00Z --> Automated triage for the maintainers. **Needs rebase.** `main` has moved, and this branch now conflicts with it in `README.md`. It will be reviewed again once it is rebased. The points from the earlier review still apply. `FIRST_BOOT_BYTES` in `apps/victory/src/run.rs` is the Series X figure. In Series S mode the same request is 63,632 × 64 KiB (3.9 GiB), so the size should come from `victory_hle::console::current()`, or the line should be labelled as the Series X case. The README sentence should match, and say it is one mapping. --- _Generated by [Claude Code](https://claude.ai/code)_
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/224:upstream-pr/224'
git switch 'upstream-pr/224'

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