Respect the console build override for XMem pools and allocation statistics #227

Closed
github-bot wants to merge 1 commit from gh-pr/227/head into gh-pr/227/base
Owner

@⁠bambermf on GitHub · 2026-11-23 06:07 UTC · original
bambermf:fix/xmem-console-build-selection → main · +8 −4 · 2 files · 1 commits · closed without merging

Library / area — XMem allocation pools and allocation statistics.

Exports affected — XMemSetAllocationHysteresis, XMemGetAllocationHysteresis and XMemGetAllocationStatistics. No export table rows changed.

Source of behaviour — The build 19041 pool granule and invalid-type behaviour were established from the Fortnite XMem DLL in #217 and #219. This change addresses how the emulator selects those implementations. I measured both calls through the release xmem.dll on Windows, with a fresh process for each configuration.

What was wrong

Both decisions used the GameInput build resolver directly. Setting TOMBOX_CONSOLE_OSBUILD or the corresponding console_os_build config key had no effect on them. A title could run with the console configured for 19041, yet pool requests rounded to 512 KiB and an invalid allocation-statistics query returned success and cleared the result fields.

Measurements

Each process set one byte of hysteresis for pool 11 and read it back. It also queried memory type 16 with a valid 32-byte output whose result words contained 5, 6 and 7.

Console build GameInput override Before This PR
19041 22000 512 KiB, success, result words cleared 4 MiB, error 87, result words preserved
22000 19041 4 MiB, error 87, result words preserved 512 KiB, success, result words cleared
unset 19041 GameInput fallback in the original resolver 4 MiB, error 87, result words preserved

The change

Use the existing console build resolver at both decision points. It already handles the console override, config file and fallback to the GameInput/title build. The existing per-process pool granule cache stays in place.

Tests

The isolated build 19041 unit test now supplies opposing console and GameInput overrides and exercises both exports for hysteresis before checking the invalid-type error and output preservation. The release XMem unit and integration suites passed. Local PR gate passed on two Rust files.

**@⁠bambermf** on GitHub · 2026-11-23 06:07 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/227) `bambermf:fix/xmem-console-build-selection` → `main` · +8 −4 · 2 files · 1 commits · closed without merging **Library / area** — XMem allocation pools and allocation statistics. **Exports affected** — XMemSetAllocationHysteresis, XMemGetAllocationHysteresis and XMemGetAllocationStatistics. No export table rows changed. **Source of behaviour** — The build 19041 pool granule and invalid-type behaviour were established from the Fortnite XMem DLL in #217 and #219. This change addresses how the emulator selects those implementations. I measured both calls through the release xmem.dll on Windows, with a fresh process for each configuration. ### What was wrong Both decisions used the GameInput build resolver directly. Setting TOMBOX_CONSOLE_OSBUILD or the corresponding console_os_build config key had no effect on them. A title could run with the console configured for 19041, yet pool requests rounded to 512 KiB and an invalid allocation-statistics query returned success and cleared the result fields. ### Measurements Each process set one byte of hysteresis for pool 11 and read it back. It also queried memory type 16 with a valid 32-byte output whose result words contained 5, 6 and 7. | Console build | GameInput override | Before | This PR | |---|---|---|---| | 19041 | 22000 | 512 KiB, success, result words cleared | 4 MiB, error 87, result words preserved | | 22000 | 19041 | 4 MiB, error 87, result words preserved | 512 KiB, success, result words cleared | | unset | 19041 | GameInput fallback in the original resolver | 4 MiB, error 87, result words preserved | ### The change Use the existing console build resolver at both decision points. It already handles the console override, config file and fallback to the GameInput/title build. The existing per-process pool granule cache stays in place. ### Tests The isolated build 19041 unit test now supplies opposing console and GameInput overrides and exercises both exports for hysteresis before checking the invalid-type error and output preservation. The release XMem unit and integration suites passed. Local PR gate passed on two Rust files.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:14:46 +00:00
github-bot closed this pull request 2026-11-26 06:14:46 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-23 13:45 UTC · original

Applied locally on main with your authorship kept (cherry-picked, 61ffabe); tests pass in a sandbox. It ships in the next release; this PR will be closed when that is pushed. Thanks.

**@⁠omonkeyz** on GitHub · 2026-11-23 13:45 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/227#issuecomment-7102980284) Applied locally on main with your authorship kept (cherry-picked, 61ffabe); tests pass in a sandbox. It ships in the next release; this PR will be closed when that is pushed. Thanks.
Author
Owner

@⁠kiwe147 on GitHub · 2026-11-23 19:15 UTC · original

Tested head 6ef2fce839, applied with git apply (whitespace ignored, the line endings of my checkout differ) on main f89e410, together with #210 (one tree; the PRs touch different files). It applied without conflicts and built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, NVIDIA GeForce RTX 3080 (driver 621.24), MSVC, Rust 1.91.1.

run result
cargo test -p xmem 96 passed, 0 failed

No new failure against main f89e410 in any of these. This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

**@⁠kiwe147** on GitHub · 2026-11-23 19:15 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/227#issuecomment-7111317307) Tested head `6ef2fce839`, applied with `git apply` (whitespace ignored, the line endings of my checkout differ) on `main` `f89e410`, together with #210 (one tree; the PRs touch different files). It applied without conflicts and built. Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, NVIDIA GeForce RTX 3080 (driver 621.24), MSVC, Rust 1.91.1. | run | result | |---|---| | `cargo test -p xmem` | 96 passed, 0 failed | No new failure against `main` `f89e410` in any of these. This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code)
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-25 13:09 UTC · original

Applied on main in 61ffabe (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

**@⁠omonkeyz** on GitHub · 2026-11-25 13:09 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/227#issuecomment-7163363614) Applied on main in 61ffabe (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.