From bf21fd8eff8aef2fed3de4a321673f85a01c7588 Mon Sep 17 00:00:00 2001 From: notdxbi <69725883+notdxbi@users.noreply.github.com> Date: Tue, 24 Nov 2026 00:58:03 +0000 Subject: [PATCH] XGameRuntime: with XCL_NETWORK=0 the connectivity hint says no network XNetworkingGetConnectivityHint answered with the host's connectivity (InternetAccess) even with XCL_NETWORK=0, where every request fails. A retail game then took itself to be online and kept asking its online service for a ticket (CreateTicketXbl3, "no Xbox Live", with growing gaps). With the hint at None (a console without a network) it asks for no token at all and goes on to stream its world. The level is worked out in connectivity_level, tested for both cases. Co-Authored-By: Claude Opus 5.5 --- crates/xcl/src/hle/xgameruntime/networking.rs | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/crates/xcl/src/hle/xgameruntime/networking.rs b/crates/xcl/src/hle/xgameruntime/networking.rs index 39e907843..09bdd2eba 100644 --- a/crates/xcl/src/hle/xgameruntime/networking.rs +++ b/crates/xcl/src/hle/xgameruntime/networking.rs @@ -589,16 +589,24 @@ fn host_connectivity_hint() -> Option { if unsafe { f(&mut hint) } == 0 { Some(hint) } else { None } } +/// The hint's level from the host's (`None`: not known). With `XCL_NETWORK=0` it is None (1), as +/// on a console without a network: answered with the host's InternetAccess, a retail game took +/// itself to be online and kept asking its online service for a ticket that never came. +fn connectivity_level(host: Option, network_off: bool) -> u32 { + match host { + _ if network_off => 1, + Some(l @ 1..=4) => l, + Some(5) => 2, // LocalAccess + _ => 3, // InternetAccess + } +} + pub unsafe extern "system" fn XNetworkingGetConnectivityHint(out: *mut XNetworkingConnectivityHint) -> HRESULT { if out.is_null() { return E_INVALIDARG; } let host = host_connectivity_hint(); - let level = match host.map(|h| h.connectivity_level) { - Some(l @ 1..=4) => l, - Some(5) => 2, // LocalAccess - _ => 3, // InternetAccess - }; + let level = connectivity_level(host.map(|h| h.connectivity_level), crate::hle::netoff::enabled()); let cost = match host.map(|h| h.connectivity_cost) { Some(c @ 1..=3) => c, _ => 1, // Unrestricted @@ -759,6 +767,17 @@ mod tests { } } + /// `XCL_NETWORK=0`: no network whatever the host has; otherwise the host's level. + #[test] + fn connectivity_level_without_network_is_none() { + for host in [None, Some(1), Some(2), Some(3), Some(4), Some(5)] { + assert_eq!(connectivity_level(host, true), 1, "host {host:?}, network off"); + } + assert_eq!(connectivity_level(Some(3), false), 3); + assert_eq!(connectivity_level(Some(5), false), 2); + assert_eq!(connectivity_level(None, false), 3); + } + #[test] fn connectivity_hint_and_pin_verification() { unsafe {