XGameRuntime: XNetworking change registrations fire the initial callback #1237

Open
github-bot wants to merge 1 commit from github-bot/gh-1237 into main AGit
Owner

@⁠emirduran707 on GitHub · 2026-11-24 13:34 UTC · original
emirduran707:xnetworking-initial-callbacks → main · +104 −9 · 1 files · 1 commits · open

XNetworkingRegisterConnectivityHintChanged and XNetworkingRegisterPreferredLocalUdpMultiplayerPortChanged handed out a token and never called the callback. Microsoft's documentation says both send a first callback when they register: the connectivity one "registers a "connectivity hint changed" notification and sends an initial notification callback", and the port one "always fires an initial notification callback". The network-initialization guidance builds on that: a title registers and then waits for the callback to report networkInitialized. Under XCL such a title waited forever, or treated the network as not up.

Both now write the token, then queue one callback on the queue's completion port through xasync::submit_callback, as notify_association does for user-association changes. The connectivity callback carries the current hint from XNetworkingGetConnectivityHint, and the port callback carries DEFAULT_UDP_PORT. A null callback is E_INVALIDARG, as for XUserRegisterForDeviceAssociationChanged. If the queue refuses the callback, its record is freed and a warning is logged.

What is in it

  • crates/xcl/src/hle/xgameruntime/networking.rs: the first callbacks; test register_fires_an_initial_callback. It uses an immediate queue and checks that each callback runs once, with network_initialized true and port 3074, and that a null callback is refused.

Tested

  • AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release
  • cargo test --workspace -- --test-threads=4 on e2a4b1d: 742 passed, 0 failed, 41 ignored; no SKIPPED GPU tests
  • the new test without the change in the two register functions: callback count left: 0, right: 1; with it it passes

Regression run

main:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1541 (PresentX 1541)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19650 MB

this PR:

xcl-smoke v1
commit: e2a4b1d3190260b7a8799b916b5de5f7a5b69ab1
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1481 (PresentX 1481)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19710 MB

Not tested

  • A title that waits for the first connectivity callback; the smoke title's run is a regression check only.
  • With #494 merged, the first callback carries its XCL_NETWORK=0 level (it comes from XNetworkingGetConnectivityHint); not run together.
  • NVIDIA and Intel GPUs.

AI use

  • Claude Code with Claude Opus 5.5: found the problem, wrote the change, the test and this description; I reviewed the diff and ran the tests and smoke runs above.

🤖 Generated with Claude Code

**@⁠emirduran707** on GitHub · 2026-11-24 13:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/1237) `emirduran707:xnetworking-initial-callbacks` → `main` · +104 −9 · 1 files · 1 commits · open `XNetworkingRegisterConnectivityHintChanged` and `XNetworkingRegisterPreferredLocalUdpMultiplayerPortChanged` handed out a token and never called the callback. Microsoft's documentation says both send a first callback when they register: the connectivity one "registers a "connectivity hint changed" notification and sends an initial notification callback", and the port one "always fires an initial notification callback". The network-initialization guidance builds on that: a title registers and then waits for the callback to report `networkInitialized`. Under XCL such a title waited forever, or treated the network as not up. Both now write the token, then queue one callback on the queue's completion port through `xasync::submit_callback`, as `notify_association` does for user-association changes. The connectivity callback carries the current hint from `XNetworkingGetConnectivityHint`, and the port callback carries `DEFAULT_UDP_PORT`. A null callback is `E_INVALIDARG`, as for `XUserRegisterForDeviceAssociationChanged`. If the queue refuses the callback, its record is freed and a warning is logged. **What is in it** - `crates/xcl/src/hle/xgameruntime/networking.rs`: the first callbacks; test `register_fires_an_initial_callback`. It uses an immediate queue and checks that each callback runs once, with `network_initialized` true and port 3074, and that a null callback is refused. **Tested** - AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release - `cargo test --workspace -- --test-threads=4` on e2a4b1d: 742 passed, 0 failed, 41 ignored; no SKIPPED GPU tests - the new test without the change in the two register functions: callback count `left: 0`, `right: 1`; with it it passes **Regression run** main: ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1541 (PresentX 1541) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 19650 MB ``` this PR: ``` xcl-smoke v1 commit: e2a4b1d3190260b7a8799b916b5de5f7a5b69ab1 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1481 (PresentX 1481) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 19710 MB ``` **Not tested** - A title that waits for the first connectivity callback; the smoke title's run is a regression check only. - With #494 merged, the first callback carries its `XCL_NETWORK=0` level (it comes from `XNetworkingGetConnectivityHint`); not run together. - NVIDIA and Intel GPUs. **AI use** - Claude Code with Claude Opus 5.5: found the problem, wrote the change, the test and this description; I reviewed the diff and ran the tests and smoke runs above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
XNetworkingRegisterConnectivityHintChanged and
XNetworkingRegisterPreferredLocalUdpMultiplayerPortChanged only handed out
a token and never called the title's callback. The GDK docs say the first
"registers a "connectivity hint changed" notification and sends an initial
notification callback", and that registering for the second "always fires
an initial notification callback". A title that waits for that callback
(for instance to see networkInitialized) waited forever.

Both now queue one callback on the queue's completion port, as
XUserRegisterForDeviceAssociationChanged does: the current hint (from
XNetworkingGetConnectivityHint) or DEFAULT_UDP_PORT. The record is freed
when the queue refuses it, and a canceled callback only frees it. The
callback is `_In_` in both signatures, so a null one is E_INVALIDARG, like
the XUser registration.

register_fires_an_initial_callback fails without this change (callback
count 0 after registering on an Immediate/Immediate queue).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:48:02 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 14:02 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib lib xgameruntime: 74 passed, 0 failed.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 14:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/1237#issuecomment-7133736920) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - cargo test -p xcl --lib lib xgameruntime: 74 passed, 0 failed. Thanks!
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 04:17 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 04:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/1237#issuecomment-7182464019) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1237/head:github-bot/gh-1237'
git switch 'github-bot/gh-1237'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1237'
git switch 'github-bot/gh-1237'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1237'
git switch 'github-bot/gh-1237'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1237'
git switch 'main'
git merge --squash 'github-bot/gh-1237'
git switch 'main'
git merge --ff-only 'github-bot/gh-1237'
git switch 'main'
git merge 'github-bot/gh-1237'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.