XGameRuntime: XPackageEnumerateChunkAvailability calls back per language chunk #2793

Open
oni-swr wants to merge 1 commit from upstream-pr/2803 into main
oni-swr commented 2026-11-26 13:51:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-26T13:51:09Z.


XPackageEnumerateChunkAvailability was mapped to ok() and never ran the callback, so a title listing the package languages got an empty list. XCL models one installed chunk per language declared in MicrosoftGame.Config (XPackageFindChunkAvailability already reports Ready), so a Language selector now gets one callback per declared language with Ready, stopping when the callback returns false. A null callback returns E_INVALIDARG. Tag, Chunk and Feature selectors have no modelled data and get no callbacks.

Fixes #2785

What is in it

  • crates/xcl/src/hle/xgameruntime/api.rs: the implementation, and test enumerate_chunk_availability_calls_back_per_matching_selector (one callback per language, early stop, no languages, other selector types, null callback). Selector layout and enum values are from the public GDK pages for XPackageChunkSelector, XPackageChunkSelectorType and XPackageChunkAvailability.

Tested

  • AMD Radeon RX 7800 XT (driver 32.0.31035.1003), Ryzen 7 5700X3D, Windows 11 Pro 10.0.26200, Rust 1.100.0, debug build (tests), release build (smoke)
  • cargo test -p xcl --lib -j 4 hle::xgameruntime: 76 passed, 0 failed, 0 ignored, 1261 filtered out, no SKIPPED
  • Whole suite on the exact head 084c8b5c (clean detached checkout, RX 7800 XT driver 32.0.31035.1003, no XCL_ADAPTER set, debug): cargo build --workspace -j 4, then cargo test --workspace -j 4 --no-fail-fast -- --test-threads=4: 1435 passed, 1 failed, 47 ignored over 37 test binaries (lib: 1309 passed, 1 failed, 27 ignored). 7 SKIPPED messages: six f16_programs_on_the_gpu / f32_programs_on_the_gpu cases the lowering refuses (V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32) and heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows). enumerate_chunk_availability_calls_back_per_matching_selector passed.
  • The one failure is gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 ("seed 722: res[30] = 0x1, CPU 0x7fffffff", #2115). It fails the same way, same seed, on main at e120925e, so it is not caused by this PR.
  • cargo clippy --lib --tests: nothing on the new code

Regression run
Same title, 60 s each, same machine, one after the other (RX 7800 XT). Blocks pasted unedited from scripts/smoke.ps1.

main:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: AMD Radeon RX 7800 XT
title: 2c508222
seconds: 60
exit: 0x0
frames shown: 1502 (PresentX 1502)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13775 MB

PR:

xcl-smoke v1
commit: 084c8b5c06f088fbe18e563ddfcb46782aeb3298
gpu: AMD Radeon RX 7800 XT
title: 2c508222
seconds: 60
exit: 0x0
frames shown: 1549 (PresentX 1549)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13772 MB

Not tested

  • Other adapters (AMD RDNA4, NVIDIA, Intel): only the RX 7800 XT was used
  • The new test was not run against the old code, so I have not seen it fail there
  • A title that calls XPackageEnumerateChunkAvailability: the smoke run is a regression check only

AI use

  • AI-assisted: Claude Code (Claude Sonnet 5.5), coordinated by Claude Code (Claude Opus 5.5). It wrote the code, the tests and this description, and ran the commands and smoke runs above.
  • The whole-suite run on the exact head and the check of the seed-722 failure against main were made with Claude Code (Claude Sonnet 5.5), which also added them to this description.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5511249774 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2803). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-26T13:51:09Z. --- `XPackageEnumerateChunkAvailability` was mapped to `ok()` and never ran the callback, so a title listing the package languages got an empty list. XCL models one installed chunk per language declared in `MicrosoftGame.Config` (`XPackageFindChunkAvailability` already reports Ready), so a Language selector now gets one callback per declared language with Ready, stopping when the callback returns false. A null callback returns `E_INVALIDARG`. Tag, Chunk and Feature selectors have no modelled data and get no callbacks. Fixes #2785 **What is in it** - `crates/xcl/src/hle/xgameruntime/api.rs`: the implementation, and test `enumerate_chunk_availability_calls_back_per_matching_selector` (one callback per language, early stop, no languages, other selector types, null callback). Selector layout and enum values are from the public GDK pages for `XPackageChunkSelector`, `XPackageChunkSelectorType` and `XPackageChunkAvailability`. **Tested** - AMD Radeon RX 7800 XT (driver 32.0.31035.1003), Ryzen 7 5700X3D, Windows 11 Pro 10.0.26200, Rust 1.100.0, debug build (tests), release build (smoke) - `cargo test -p xcl --lib -j 4 hle::xgameruntime`: 76 passed, 0 failed, 0 ignored, 1261 filtered out, no SKIPPED - Whole suite on the exact head `084c8b5c` (clean detached checkout, RX 7800 XT driver 32.0.31035.1003, no `XCL_ADAPTER` set, debug): `cargo build --workspace -j 4`, then `cargo test --workspace -j 4 --no-fail-fast -- --test-threads=4`: 1435 passed, 1 failed, 47 ignored over 37 test binaries (lib: 1309 passed, 1 failed, 27 ignored). 7 SKIPPED messages: six `f16_programs_on_the_gpu` / `f32_programs_on_the_gpu` cases the lowering refuses (V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32) and `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). `enumerate_chunk_availability_calls_back_per_matching_selector` passed. - The one failure is `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` ("seed 722: res[30] = 0x1, CPU 0x7fffffff", #2115). It fails the same way, same seed, on `main` at `e120925e`, so it is not caused by this PR. - `cargo clippy --lib --tests`: nothing on the new code **Regression run** Same title, 60 s each, same machine, one after the other (RX 7800 XT). Blocks pasted unedited from `scripts/smoke.ps1`. main: ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: AMD Radeon RX 7800 XT title: 2c508222 seconds: 60 exit: 0x0 frames shown: 1502 (PresentX 1502) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13775 MB ``` PR: ``` xcl-smoke v1 commit: 084c8b5c06f088fbe18e563ddfcb46782aeb3298 gpu: AMD Radeon RX 7800 XT title: 2c508222 seconds: 60 exit: 0x0 frames shown: 1549 (PresentX 1549) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13772 MB ``` **Not tested** - Other adapters (AMD RDNA4, NVIDIA, Intel): only the RX 7800 XT was used - The new test was not run against the old code, so I have not seen it fail there - A title that calls `XPackageEnumerateChunkAvailability`: the smoke run is a regression check only **AI use** - AI-assisted: Claude Code (Claude Sonnet 5.5), coordinated by Claude Code (Claude Opus 5.5). It wrote the code, the tests and this description, and ran the commands and smoke runs above. - The whole-suite run on the exact head and the check of the seed-722 failure against `main` were made with Claude Code (Claude Sonnet 5.5), which also added them to this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ettehn commented 2026-11-26 15:03:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ettehn on 2026-11-26T14:03:51Z.


Independent Windows A/B through QueryApiImpl and XPackage slot 13, with only the same test added on each checkout (b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 and 084c8b5c06f088fbe18e563ddfcb46782aeb3298). The test supplied a synthetic MicrosoftGame.Config with en-US and fr-FR through the normal manifest loader.

  • Main returned S_OK with zero callbacks through both the current interface and the legacy V1 interface. The test failed on the expected callback assertion.
  • PR head returned one Ready callback per language on both interfaces, in manifest order. Returning false from the callback stopped after en-US. The non-language selector returned S_OK without invoking the callback.

Windows 11 build 26200, Ryzen 9 8945HX, Rust 1.97.1 MSVC debug. cargo test --locked --offline -p xcl --lib -j 2 -- hle::xgameruntime::api::tests::package_language_callbacks_through_current_and_legacy_slots --exact --test-threads=1 --nocapture was 0 passed / 1 failed on main and 1 passed / 0 failed on the PR. A separate PR process ran hle::xgameruntime, excluding the local test that sets the boot config, with 76 passed, 0 failed, 0 ignored and no reported skips. No title or full workspace run in this check.

OpenAI Codex assisted with the test and verification. The exact model identifier was unavailable in this session.

<!-- greyfinch-sync:ivall/xcl:comment:7194224532 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2803#issuecomment-7194224532). Originally posted by [ettehn](https://github.com/ettehn) on 2026-11-26T14:03:51Z. --- Independent Windows A/B through `QueryApiImpl` and XPackage slot 13, with only the same test added on each checkout (`b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7` and `084c8b5c06f088fbe18e563ddfcb46782aeb3298`). The test supplied a synthetic `MicrosoftGame.Config` with `en-US` and `fr-FR` through the normal manifest loader. - Main returned `S_OK` with zero callbacks through both the current interface and the legacy V1 interface. The test failed on the expected callback assertion. - PR head returned one `Ready` callback per language on both interfaces, in manifest order. Returning `false` from the callback stopped after `en-US`. The non-language selector returned `S_OK` without invoking the callback. Windows 11 build 26200, Ryzen 9 8945HX, Rust 1.97.1 MSVC debug. `cargo test --locked --offline -p xcl --lib -j 2 -- hle::xgameruntime::api::tests::package_language_callbacks_through_current_and_legacy_slots --exact --test-threads=1 --nocapture` was 0 passed / 1 failed on main and 1 passed / 0 failed on the PR. A separate PR process ran `hle::xgameruntime`, excluding the local test that sets the boot config, with 76 passed, 0 failed, 0 ignored and no reported skips. No title or full workspace run in this check. OpenAI Codex assisted with the test and verification. The exact model identifier was unavailable in this session.
github-actions[bot] commented 2026-12-01 02:34:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:34:45Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7298766742 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2803#issuecomment-7298766742). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-12-01T02:34:45Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 09:00:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:00:18Z.


Triage (#1607) – head 084c8b5

No open or merged PR makes the same change; main still maps XPackageEnumerateChunkAvailability to ok.
No problems found in the diff: ChunkSelector matches the GDK layout (u32 type, pointer union at 8), the CString outlives each callback, enumeration stops on false, and non-language selector types get no callback, which matches the no-tags/no-features model of the other XPackage stubs.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7306077762 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2803#issuecomment-7306077762). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T09:00:18Z. --- **Triage (#1607)** – head 084c8b5 No open or merged PR makes the same change; main still maps `XPackageEnumerateChunkAvailability` to `ok`. No problems found in the diff: `ChunkSelector` matches the GDK layout (u32 type, pointer union at 8), the `CString` outlives each callback, enumeration stops on `false`, and non-language selector types get no callback, which matches the no-tags/no-features model of the other XPackage stubs. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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/2803:upstream-pr/2803'
git switch 'upstream-pr/2803'

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