HLE: deliver initial XNetworking registration callbacks and track unregister tokens #2998
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2998
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2998"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@fuzeofficlal on GitHub · 2026-11-26 02:58 UTC · original
fuzeofficlal:fix/hle-xnetworking-initial-callbacks→main· +317 −53 · 3 files · 1 commits · openSummary
XNetworkingregistration callbacks through the caller'sXTaskQueuecompletion port (XTaskQueueSubmitDelayedCallbackwith zero delay) for both preferred local UDP multiplayer port (0x30,3074) and connectivity hint (0x80,OFFLINEwithinitialized = true).xnetworking.rsso0x38(unregister_port) and0x88(unregister_hint) only cancel and remove matching event registrations, prevent double-unregistration, honorwait = truevia condvar synchronization when a callback is currently executing on another thread, and avoid self-deadlock when a callback attempts to unregister itself.E_INVALIDARGwhen either the callback pointer (_In_) or output token pointer (_Out_) is null, and roll back the registration + output token if task-queue submission fails.Specification basis (public Microsoft Learn GDK documentation)
XNetworkingRegisterConnectivityHintChanged— Remarks: "This function registers a 'connectivity hint changed' notification and sends an initial notification callback."queueandcontextare_In_opt_(a null queue uses the process task queue, matchingxasync::queue), whilecallback(_In_) andtoken(_Out_) are required. See also Detecting network initialization status (titles can wait forXNetworkingConnectivityHint::networkInitialized == trueviaXNetworkingRegisterConnectivityHintChanged).XNetworkingRegisterPreferredLocalUdpMultiplayerPortChanged— Remarks: "Registering for a preferred local User Datagram Protocol (UDP) multiplayer port change notification always fires an initial notification callback."queueandcontextare_In_opt_(using the queue's completion port for callback delivery), whilecallback(_In_) andtoken(_Out_) are required. See also Preferred local UDP multiplayer port networking APIs (lists notification registration as one of the three ways to retrieve the initial preferred port).XNetworkingUnregisterConnectivityHintChangedandXNetworkingUnregisterPreferredLocalUdpMultiplayerPortChanged— document thewaitblocking behavior and polling (wait == falsereturnsfalsewhile a callback is executing andtrueonce completed).Verification
cargo test -p victory-hle --locked modules::xnetworking::andmodules::xasync::: all tests passed (including 4 new unit tests covering completion-port delivery, token/event matching and cancellation, null callback/token rejection, and immediate-queue self-unregister safety).cargo clippy -p victory-hle --locked --all-targets -- -D warnings(default and--all-features): 0 warnings.cargo test -p xtask --locked policy::tests::repository_passes_policy: ok.a60d2794e7toede11f17fb@futurepro62 on GitHub · 2026-11-26 04:44 UTC · original
Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head
a60d279(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 870 passed, 0 failed, 10 ignored.initial_callbacks_use_the_completion_port,unregister_cancels_only_the_matching_token,registration_rejects_missing_callback_or_token,immediate_callback_can_try_to_unregister_itself.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
@Marvisak on GitHub · 2026-11-26 05:23 UTC · original · edited 2026-11-26 07:19 UTC
Automated triage for the maintainers.
Thanks for the references; they answer our request for evidence. The public documentation for both registration functions says an initial notification is always sent, and that
callbackandtokenare required. The new code incrates/victory-hle/src/modules/xnetworking.rsmatches this.registerqueuesdeliver_initialon the caller's queue (completion port) with zero delay and returnsE_INVALIDARGfor a null callback or token.unregistermatches the token and the event, drops a callback that is still pending, and waits for a running one unless that callback is unregistering itself. The answers stayOFFLINEand port 3074, so nothing new reaches the network. TheVTABLEalignment nit is fixed.Merge candidate. One point for the maintainers: there is no title run, so any effect on the title's startup ordering is unmeasured.
CI: passing.
Recommending a look, not approving.
Generated by Claude Code
@fuzeofficlal on GitHub · 2026-11-26 05:40 UTC · original
Updated the PR description with the public Microsoft Learn GDK references and fixed the
VTABLEcomment column alignment nit on rows0x30,0x38,0x80, and0x88:XNetworkingRegisterConnectivityHintChangedexplicitly documents: "This function registers a 'connectivity hint changed' notification and sends an initial notification callback." (callbackis_In_,tokenis_Out_;queueandcontextare_In_opt_).XNetworkingRegisterPreferredLocalUdpMultiplayerPortChangedexplicitly documents: "Registering for a preferred local User Datagram Protocol (UDP) multiplayer port change notification always fires an initial notification callback." (callbackis_In_,tokenis_Out_;queueandcontextare_In_opt_).XNetworkingUnregisterConnectivityHintChanged/XNetworkingUnregisterPreferredLocalUdpMultiplayerPortChangeddocument thewaitblocking / non-blocking poll return semantics.Not tested with a title run (unit tests + public API spec only). Re-verified
cargo test -p victory-hle --locked modules::xnetworking::(5/5),cargo clippy -p victory-hle --locked --all-targets -- -D warnings, andpolicy::tests::repository_passes_policyafter the nit fix.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.