From 576b4db5d8133d0fa184174141be4e7637811c2c Mon Sep 17 00:00:00 2001 From: ivall Date: Sat, 21 Nov 2026 16:22:32 +0100 Subject: [PATCH] XGameRuntime from the GDK function table: persistent local storage, console device type, more APIs - Persistent local storage was passed to the PC runtime, which fails it for an unpackaged process: now XCL's own. - XSystemGetDeviceType is computed by the thunk library from HKLM\...\OEM ConsoleMode (mapping read from the game's XCurl.dll): kernelx answers that registry key (0x64 Series X, 0x60 Series S); advapi32 imports go through kernelx. - gdk_table.rs: the GDK runtime's 396 functions with class, interface and slot as the public PC GDK's thunk library calls them. XCL's objects are built from it by function name: the interface versions of a class share a vtable, unknown versions get the main one, and unimplemented functions are reported by name. Agrees with the slots the game's own thunks use (test) and fixes two guessed XPackage slots. - New: XUser devices and the remaining XUser calls, XPackage (locale, chunks, install, MountWithUi, EnumeratePackages), XSystem, analytics, runtime features, XDisplay, XGameEvent (offline); XAppBroadcast / XAppCapture refused. - Pipelines: releasing a stand-in releases its background-built pipeline and forgets the address; PSO tests work with a cold DXIL cache. --- HANDOFF.md | 31 +- README.md | 4 +- crates/xcl/Cargo.toml | 1 + crates/xcl/src/hle/d3d12x/pso_async.rs | 35 +- crates/xcl/src/hle/d3d12x/real.rs | 11 + crates/xcl/src/hle/kernelx.rs | 109 +++ crates/xcl/src/hle/mod.rs | 2 +- crates/xcl/src/hle/xgameruntime/api.rs | 717 +++++++++++++++---- crates/xcl/src/hle/xgameruntime/gdk_table.rs | 403 +++++++++++ crates/xcl/src/hle/xgameruntime/mod.rs | 7 +- crates/xcl/tests/gpu_pso_e2e.rs | 42 +- scripts/gen_gdk_table.py | 24 + 12 files changed, 1224 insertions(+), 162 deletions(-) create mode 100644 crates/xcl/src/hle/xgameruntime/gdk_table.rs create mode 100644 scripts/gen_gdk_table.py diff --git a/HANDOFF.md b/HANDOFF.md index 677bd6e..abcebd4 100644 --- a/HANDOFF.md +++ b/HANDOFF.md @@ -536,6 +536,32 @@ Nothing open. Unexplained: 6 packets per subblock with a table difference of 12·960 – TOC 0xFC is CELT FB 20 ms **stereo**, so the table probably counts samples × channels. +## XGameRuntime: objects from the GDK table, persistent local storage, device type (session 5, 2026-11-21) +- **Persistent local storage gap:** class `f4faf4d4` / `41a4e10c` went to the PC runtime, which fails it (E_FAIL) for an + unpackaged process – a title would not get its PLS path. Now XCL's (GetPathSize / GetPath / GetSpaceInfo; the space a + title asks for is granted). Slots agree with the game's libHttpClient thunks (3: 1 ptr, 4: 3 args, 5: 1 ptr, 6, 7, 8). +- **Device type:** `XSystemGetDeviceType` is computed in the thunk library, not through QueryApiImpl: `RegOpenKeyW(HKLM, + Software\Microsoft\Windows NT\CurrentVersion\OEM)` + `RegQueryValueExW(ConsoleMode)` – mapping read from the thunk in the + game's XCurl.dll: 0x60 → Lockhart (6), 0x64 → Anaconda (7), 0x68 → devkit (8), 0x40 / 0x50 / 0x58 → Xbox One S / X / + devkit, no key → PC (1). kernelx now answers `RegOpenKeyW` / `RegOpenKeyExW` / `RegQueryValueExW` / `RegCloseKey` for + that key only (0x64 or 0x60 by `device_type`); `advapi32.dll` imports go through kernelx (other functions still resolve + to advapi32 itself). +- **GDK table** (`hle/xgameruntime/gdk_table.rs`, `scripts/gen_gdk_table.py`): 396 functions → (class, interface, slot) as + the public PC GDK's `xgameruntime.lib` calls them. XCL's objects are built from it **by function name** (`api::layout`): + a class's interface ids whose slots do not collide share one vtable – they are GDK versions appending functions (XUser: + base 3..36, `eb9bf948` 37–38, `079415e3` 42, `26f3c674` 43–46, `5131d685` 47–49); `cef4fac0` (XUserGetGamertag) has its + own. An interface id the table does not know (another GDK version: the game's libHttpClient asks XPackage `e2a4734b`, + the table has `0b9d556e`) gets the main vtable. Unimplemented functions are logged and reported by name. + The table agrees with the hand mapping from the game's thunks (test `vtables_follow_the_gdk_table`) and corrects two + guessed XPackage slots (EnumerateFeatures = 33, 27 = GetIdentifier). +- **New in XCL:** XUser device association (registration tokens, FindForDevice → not found); XUser privilege / issue UI + (completed), sign-out deferral (not available), AddByIdWithUi, Platform* hooks, IsSignOutPresent / IsStoreUser (false), + SignOut; XPackage locale (Windows), chunks (all ready, install = done, estimate 0), write stats, kind (Game), + MountWithUi, EnumeratePackages (the game itself with its details); XSystem app-specific device id, handle tracking; + analytics (family "Windows.Xbox", OS 10.0.25398, Series X / S); runtime features (true); XDisplay (XLaunchUri refused, + timeout deferral); XGameEvent (offline: accepted, dropped). Refused: XStore, XAppBroadcast, XAppCapture. +- Tests: `vtables_follow_the_gdk_table`, `console_mode_registry_value`, PLS in `thunk_protocol_with_xcl_objects_on_pc_queues`. + ## Non-blocking pipeline creation (session 5, 2026-11-21) - **Gap:** DXC ran in the title's `Create*PipelineState` call: 0.2 s median, seconds for big programs – thousands of pipelines while a title loads meant minutes of stall on the first run (the DXIL disk cache helps only later runs). @@ -554,7 +580,10 @@ Nothing open. in the background renders the same triangle pixel for pixel; a mesh pipeline returns after ~0.1 s, real after ~1 s, two-pass parts found through the stand-in, title's description freed before the worker ran); the game's BVH builder with an empty cache (52 programs compiled in the background, compute waited for at replay) builds BLAS + TLAS. -- Not yet: releasing a stand-in does not release its real pipeline (pipelines live until the process ends). +- Releasing a stand-in for good (PipelineState `Release` override) releases its real pipeline and forgets the address + (a later object at the same address must not resolve to it); a stand-in released while building: the worker's result is + released when it arrives. Tests: `pso_through_hook` returns the real pipeline (works with a cold DXIL cache), the + background test restores `XCL_DXIL_CACHE` through a guard. ## Title memory above 4 GB: UMA windows (session 5, 2026-11-21) - **Gap:** shaders addressed one `mem` buffer with the low 32 bits of the address, and D3D12 opens a heap from an diff --git a/README.md b/README.md index 056ad03..973f692 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ measurements and next steps: | Feature | State | What it does | Verified by | |---|---|---|---| -| **XGameRuntime** | ✅ | the GDK thunk protocol real titles use; offline XUser, XGameSave, XPackage, XGame (title id), XSystem; task queues, async, networking and dialogs through the PC's XGameRuntime | the game's libHttpClient initialises; users and saves through the real call path | +| **XGameRuntime** | ✅ | the GDK thunk protocol real titles use, laid out from a table of all 396 GDK runtime functions; offline XUser, XGameSave, persistent local storage, XPackage, XGame (title id), XSystem – the title sees an Xbox Series X / S; task queues, async, networking and dialogs through the PC's XGameRuntime | the game's libHttpClient initialises; users, saves and storage through the real call path; slot layout cross-checked against the game's own thunks | | **Input** | ✅ | GameInput → the system GameInput | – | | **Audio** | 🟡 | XAudio2 → system XAudio2.9 (PCM / float voices) | unit tests; Opus / XMA2 voices are silent for now | @@ -71,7 +71,7 @@ measurements and next steps: | D3D12.X draw records and `PresentX` / frame pacing | – | Xbox Live, Store licensing (offline by design) | | root arguments → shader registers for graphics | Opus / XMA2 audio decoding | decrypting XVC packages or any DRM | | texture creation in title memory (binding the detiler) | hull / domain / amplification shaders (none in the sample game) | console SDK headers / binaries in the repository | -| the persistent-local-storage class and `XSystemGetDeviceType` slot of the thunk protocol | linear / 3D / MSAA tiled textures | | +| – | linear / 3D / MSAA tiled textures | | | Bink GPU decoding, rehydrating prebuilt BVHs | performance work (GPU buffers live in system memory) | | Every run writes `report.json` (called stubs, unknown D3D12.X slots and interfaces, XGameRuntime diff --git a/crates/xcl/Cargo.toml b/crates/xcl/Cargo.toml index 007c590..d476aa9 100644 --- a/crates/xcl/Cargo.toml +++ b/crates/xcl/Cargo.toml @@ -53,6 +53,7 @@ features = [ "Win32_System_LibraryLoader", "Win32_System_Memory", "Win32_System_Performance", + "Win32_System_Registry", "Win32_System_ProcessStatus", "Win32_System_SystemInformation", "Win32_System_SystemServices", diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs index c5dcdea..4764986 100644 --- a/crates/xcl/src/hle/d3d12x/pso_async.rs +++ b/crates/xcl/src/hle/d3d12x/pso_async.rs @@ -17,6 +17,8 @@ struct Pending { done: Mutex, cv: Condvar, compute: bool, + /// the stand-in was released before the real pipeline was built + orphan: std::sync::atomic::AtomicBool, } /// stand-in handed to the title → its real pipeline @@ -49,8 +51,13 @@ fn queue() -> &'static Mutex, Job)>> { } else { BUILT.fetch_add(1, Ordering::Relaxed); } - p.real.store(real, Ordering::Release); - *p.done.lock().unwrap() = true; + let mut done = p.done.lock().unwrap(); + if p.orphan.load(Ordering::Acquire) { + release(real); + } else { + p.real.store(real, Ordering::Release); + } + *done = true; p.cv.notify_all(); }); } @@ -58,9 +65,16 @@ fn queue() -> &'static Mutex, Job)>> { }) } +/// Release a pipeline state XCL owns (raw pointer, 0 = none). +pub fn release(p: usize) { + if p != 0 { + unsafe { drop(::from_raw(p as *mut std::ffi::c_void)) }; + } +} + /// `standin` went to the title; `job` builds the real pipeline on a worker. pub fn submit(standin: usize, compute: bool, job: Job) { - let p = Arc::new(Pending { real: AtomicUsize::new(0), done: Mutex::new(false), cv: Condvar::new(), compute }); + let p = Arc::new(Pending { real: AtomicUsize::new(0), done: Mutex::new(false), cv: Condvar::new(), compute, orphan: Default::default() }); PENDING.lock().unwrap().get_or_insert_with(HashMap::new).insert(standin, p.clone()); static ONCE: std::sync::Once = std::sync::Once::new(); ONCE.call_once(|| { @@ -103,6 +117,21 @@ pub fn resolve_for_bind(pso: usize) -> usize { } } +/// The title released stand-in `pso` for good: forget it (its address may come back for +/// another object) and return its real pipeline to release (0: none, or still being built – +/// the worker's result is then released when it arrives). +pub fn released(pso: usize) -> usize { + let Some(p) = PENDING.lock().unwrap().as_mut().and_then(|m| m.remove(&pso)) else { return 0 }; + let done = p.done.lock().unwrap(); + if *done { + p.real.swap(0, Ordering::AcqRel) + } else { + // the worker stores its result into a Pending nobody will read: mark it orphaned + p.orphan.store(true, Ordering::Release); + 0 + } +} + /// `pso` is a stand-in whose real pipeline is still being built. pub fn is_pending(pso: usize) -> bool { entry(pso).is_some_and(|p| !*p.done.lock().unwrap()) diff --git a/crates/xcl/src/hle/d3d12x/real.rs b/crates/xcl/src/hle/d3d12x/real.rs index 63f0b70..72d7c62 100644 --- a/crates/xcl/src/hle/d3d12x/real.rs +++ b/crates/xcl/src/hle/d3d12x/real.rs @@ -716,6 +716,16 @@ unsafe extern "system" fn res_release(this: *mut c_void) -> u32 { n } +/// A stand-in pipeline released for good takes its background-built real pipeline with it. +unsafe extern "system" fn pso_release(this: *mut c_void) -> u32 { + let f: unsafe extern "system" fn(*mut c_void) -> u32 = std::mem::transmute(orig_fn(this, 2)); + let n = f(this); + if n == 0 { + super::pso_async::release(super::pso_async::released(this as usize)); + } + n +} + /// resource #11 GetGPUVirtualAddress for console code unsafe extern "system" fn res_gpu_va_x(this: *mut c_void) -> u64 { if let Some((p, _)) = console_buffer(this as usize) { @@ -1028,6 +1038,7 @@ fn overrides(kind: Kind) -> Vec<(&'static str, usize)> { Kind::CommandQueue => v.push(("ExecuteCommandLists", q_execute_command_lists as usize)), Kind::CommandAllocator => v.push(("Reset", alloc_reset as usize)), Kind::Resource => v.push(("Release", res_release as usize)), + Kind::PipelineState => v.push(("Release", pso_release as usize)), Kind::DescriptorHeap => v.push(("Release", heap_release as usize)), _ => {} } diff --git a/crates/xcl/src/hle/kernelx.rs b/crates/xcl/src/hle/kernelx.rs index 15a47e1..62dedd6 100644 --- a/crates/xcl/src/hle/kernelx.rs +++ b/crates/xcl/src/hle/kernelx.rs @@ -24,6 +24,11 @@ type BOOL = i32; pub fn exports() -> Vec<(&'static str, usize)> { crate::hle_exports![ + // registry: the console mode the GDK thunks read (XSystemGetDeviceType) + RegOpenKeyW, + RegOpenKeyExW, + RegQueryValueExW, + RegCloseKey, // memory VirtualAlloc, VirtualAllocEx, @@ -507,6 +512,85 @@ pub unsafe extern "system" fn GetSystemOSVersion(out: *mut SystemOsVersionInfo) *out = SystemOsVersionInfo { major: major as u8, minor: minor as u8, build: build as u16, revision: 0 }; } +// --------------------------------------------------------------------------------------- +// Registry: the console mode +// --------------------------------------------------------------------------------------- +// +// The GDK thunks a title links compute XSystemGetDeviceType from +// HKLM\Software\Microsoft\Windows NT\CurrentVersion\OEM, value ConsoleMode (REG_DWORD): +// 0x64 Series X (XboxScarlettAnaconda), 0x60 Series S (Lockhart), 0x68 devkit, 0x40 / 0x50 / +// 0x58 Xbox One S / X / devkit, no key = PC – read from the thunk in the game's XCurl.dll. +// Only that key is answered here; everything else goes to the real registry. + +const OEM_KEY: &str = "software\\microsoft\\windows nt\\currentversion\\oem"; +/// handle of the answered key (never reaches the real registry) +const OEM_HANDLE: usize = 0x5843_4C4F; // "XCLO" + +fn console_mode() -> u32 { + if crate::state::config().is_series_s() { + 0x60 + } else { + 0x64 + } +} + +unsafe fn is_oem_key(root: usize, path: *const u16) -> bool { + let hklm = windows_sys::Win32::System::Registry::HKEY_LOCAL_MACHINE as usize; + root == hklm && from_wide_ptr(path).is_some_and(|p| p.trim_start_matches('\\').eq_ignore_ascii_case(OEM_KEY)) +} + +pub unsafe extern "system" fn RegOpenKeyExW(root: usize, path: *const u16, options: u32, sam: u32, out: *mut usize) -> u32 { + if is_oem_key(root, path) && !out.is_null() { + crate::xlog_debug!("registry: OEM key → console mode {:#x}", console_mode()); + *out = OEM_HANDLE; + return 0; + } + windows_sys::Win32::System::Registry::RegOpenKeyExW(root as _, path, options, sam, out as _) +} + +pub unsafe extern "system" fn RegOpenKeyW(root: usize, path: *const u16, out: *mut usize) -> u32 { + if is_oem_key(root, path) && !out.is_null() { + *out = OEM_HANDLE; + return 0; + } + windows_sys::Win32::System::Registry::RegOpenKeyW(root as _, path, out as _) +} + +pub unsafe extern "system" fn RegQueryValueExW(key: usize, name: *const u16, reserved: *mut u32, ty: *mut u32, data: *mut u8, size: *mut u32) -> u32 { + if key != OEM_HANDLE { + return windows_sys::Win32::System::Registry::RegQueryValueExW(key as _, name, reserved, ty, data, size); + } + const ERROR_FILE_NOT_FOUND: u32 = 2; + const ERROR_MORE_DATA: u32 = 234; + if !from_wide_ptr(name).is_some_and(|n| n.eq_ignore_ascii_case("ConsoleMode")) { + return ERROR_FILE_NOT_FOUND; + } + if !ty.is_null() { + *ty = 4; // REG_DWORD + } + if !data.is_null() { + if size.is_null() || *size < 4 { + if !size.is_null() { + *size = 4; + } + return ERROR_MORE_DATA; + } + std::ptr::copy_nonoverlapping(console_mode().to_le_bytes().as_ptr(), data, 4); + } + if !size.is_null() { + *size = 4; + } + 0 +} + +pub unsafe extern "system" fn RegCloseKey(key: usize) -> u32 { + if key == OEM_HANDLE { + 0 + } else { + windows_sys::Win32::System::Registry::RegCloseKey(key as _) + } +} + // --------------------------------------------------------------------------------------- // Modules // --------------------------------------------------------------------------------------- @@ -712,6 +796,31 @@ pub unsafe extern "system" fn DisableThreadLibraryCalls(h: usize) -> BOOL { mod tests { use super::*; + /// The GDK thunks' device type lookup: RegOpenKeyW(HKLM\…\OEM) + RegQueryValueExW(ConsoleMode). + #[test] + fn console_mode_registry_value() { + unsafe { + let hklm = windows_sys::Win32::System::Registry::HKEY_LOCAL_MACHINE as usize; + let path = crate::util::wide("Software\\Microsoft\\Windows NT\\CurrentVersion\\OEM"); + let mut k = 0usize; + assert_eq!(RegOpenKeyW(hklm, path.as_ptr(), &mut k), 0); + let (mut ty, mut v, mut n) = (0u32, 0u32, 4u32); + let name = crate::util::wide("ConsoleMode"); + assert_eq!(RegQueryValueExW(k, name.as_ptr(), std::ptr::null_mut(), &mut ty, &mut v as *mut u32 as *mut u8, &mut n), 0); + assert_eq!((ty, n), (4, 4)); + assert_eq!(v, console_mode()); + let other = crate::util::wide("Other"); + assert_eq!(RegQueryValueExW(k, other.as_ptr(), std::ptr::null_mut(), &mut ty, &mut v as *mut u32 as *mut u8, &mut n), 2); + assert_eq!(RegCloseKey(k), 0); + // any other key: the real registry + let real = crate::util::wide("Software\\Microsoft\\Windows NT\\CurrentVersion"); + let mut r = 0usize; + assert_eq!(RegOpenKeyExW(hklm, real.as_ptr(), 0, 0x20019, &mut r), 0); + assert_ne!(r, OEM_HANDLE); + assert_eq!(RegCloseKey(r), 0); + } + } + #[test] fn console_alloc_flags_are_stripped() { assert_eq!(sanitize_alloc_type(MEM_GRAPHICS | 0x1000 | 0x2000), 0x3000); diff --git a/crates/xcl/src/hle/mod.rs b/crates/xcl/src/hle/mod.rs index 31830a8..8759fe8 100644 --- a/crates/xcl/src/hle/mod.rs +++ b/crates/xcl/src/hle/mod.rs @@ -97,7 +97,7 @@ fn build(config: &Config) -> Registry { } } let k = idx(KERNELX); - for p in ["kernelx.dll", "kernel32.dll", "kernelbase.dll", "api-ms-win-core-*", "ext-ms-win-core-*"] { + for p in ["kernelx.dll", "kernel32.dll", "kernelbase.dll", "advapi32.dll", "api-ms-win-core-*", "ext-ms-win-core-*"] { routes.push((p.into(), Route::Hle(k))); } let x = idx(XGAMERUNTIME); diff --git a/crates/xcl/src/hle/xgameruntime/api.rs b/crates/xcl/src/hle/xgameruntime/api.rs index d867216..7779422 100644 --- a/crates/xcl/src/hle/xgameruntime/api.rs +++ b/crates/xcl/src/hle/xgameruntime/api.rs @@ -4,19 +4,26 @@ //! `QueryApiImpl(clsid, iid)`; an API call is a call through a slot of its vtable (0..2 are //! IUnknown). The by-name exports in `mod.rs` are for titles that import them directly. //! -//! XCL answers itself for what must stay offline and XCL-managed – XUser (one local user), -//! XGameSave (saves in the XCL data folder), XPackage, XGame (title id from the game's -//! MicrosoftGame.Config), XSystem ids, the XGameUi dialogs that do not take a user –, refuses -//! XStore and XUser device association (the thunk then returns its "API not available" -//! error), and passes everything else to the PC's own XGameRuntime -//! (`System32\xgameruntime.dll`: the same classes under the same GUIDs) – XTaskQueue / XAsync, -//! XThread, XNetworking, XGameInvite… Once the PC runtime is in use, the queues and async blocks -//! are its own, so XCL's async APIs run on its XAsync (`xasync::use_pc`). +//! XCL answers itself for what must stay offline and XCL-managed – XUser (one local user, its +//! devices), XGameSave (saves in the XCL data folder), persistent local storage, XPackage (a +//! fully installed package), XGame (title id from the game's MicrosoftGame.Config), XSystem and +//! its analytics (a Series X / S), runtime features, display deferrals, game events (offline: +//! dropped), the XGameUi dialogs that do not take a user –, refuses XStore, app broadcast and +//! app capture (the thunk then returns its "API not available" error), and passes everything +//! else to the PC's own XGameRuntime (`System32\xgameruntime.dll`: the same classes under the +//! same GUIDs) – XTaskQueue / XAsync, XThread, XNetworking, XGameInvite… Once the PC runtime is +//! in use, the queues and async blocks are its own, so XCL's async APIs run on its XAsync +//! (`xasync::use_pc`). Nothing that takes an XCL user handle goes to the PC runtime: it does not +//! validate foreign handles. //! -//! Classes and slots: from the thunks in the console DLLs (which (clsid, iid) and slot every -//! thunk uses, its argument and result widths) and the PC runtime (API names its slots refer -//! to); slots follow the order of the GDK headers. Slots XCL does not implement are logged and -//! listed in the report (`xgameruntime.unimplemented`). +//! Layout: `gdk_table` (extracted from the public PC GDK's thunk library) gives every +//! function's (class, interface, slot); XCL's objects are built from it by +//! function name. A class's interface ids that do not share slots share one vtable (later GDK +//! versions append functions under new interface ids); an interface id the table does not know +//! (another GDK version) gets the class's main vtable. The slot maps agree with what the thunks +//! in the game's DLLs use (argument and result widths) and with the names in the PC runtime's +//! slots. Functions XCL does not implement are logged and listed in the report by name +//! (`xgameruntime.unimplemented`). #![allow(non_snake_case)] @@ -51,37 +58,42 @@ const fn g(v: u128) -> Guid { } pub const XUSER: Guid = g(0x01acd177_91f9_4763_a38e_ccbb55ce32e0); -const XUSER_IID: Guid = g(0x26f3c674_a2fe_44fa_b6c4_a323bc94ff53); -/// second interface of the XUser object: XUserGetGamertag with a gamertag component +/// interface of XUserGetGamertag (with a gamertag component): its own vtable +#[cfg_attr(not(test), allow(dead_code))] const XUSER_GAMERTAG_IID: Guid = g(0xcef4fac0_7676_4a94_a119_4c43f9eb5b74); const XUSER_DEVICE: Guid = g(0x7d824997_10dc_45ab_86b7_2737767c0bf1); pub const XGAMESAVE: Guid = g(0x704c3f58_e629_4cc2_b197_30511b996fe2); -const XGAMESAVE_IIDS: [Guid; 2] = [g(0x1bfff3af_f14a_40a3_8e35_9ada906593f9), g(0xab4ae4fb_6508_4950_a032_45fd4bf8c43b)]; +/// the interface the game's libHttpClient asks for (GDK table: 0b9d556e) +#[cfg_attr(not(test), allow(dead_code))] +const XPACKAGE_OLD_IID: Guid = g(0xe2a4734b_2f4a_456d_aa8f_d065e04fb209); pub const XPACKAGE: Guid = g(0xaf406016_e850_4aa8_a88d_2f3dcb9dac7e); -const XPACKAGE_IID: Guid = g(0xe2a4734b_2f4a_456d_aa8f_d065e04fb209); +pub const XPLS: Guid = g(0xf4faf4d4_2d04_4fce_b3e0_474a713a3e84); pub const XGAME: Guid = g(0x973a344e_24bf_4d0f_8457_56c534892b29); -const XGAME_IID: Guid = g(0x2549f142_6419_4a06_97b5_931aab7c2f34); pub const XSYSTEM: Guid = g(0xe349bd1a_fc20_4e40_b99c_4178cc6b409f); -const XSYSTEM_IID: Guid = g(0x1861cf2e_e18b_4834_a9f5_b4a4e6efb4cf); +const XANALYTICS: Guid = g(0xb884675d_b738_4a9c_815d_9a9a1e0c6c9b); +const XFEATURE: Guid = g(0x8836fe87_edb9_4fe3_8dad_05f0d2cd5b40); +const XDISPLAY: Guid = g(0x1b339674_328d_4283_a200_3171f18d3639); +const XGAMEEVENT: Guid = g(0xbbfbdcc7_bfe7_409b_a5ca_edf054960b4d); pub const XGAMEUI: Guid = g(0xdfcd4649_4ff8_4043_ba07_35d607df98b0); -const XGAMEUI_IID: Guid = g(0xeaf669df_5542_4590_99a3_8dc061f837cc); const XSTORE: Guid = g(0x0dd112ac_7c24_448c_b92b_3960fb5bd30c); +const XAPPBROADCAST: Guid = g(0x186d5592_a72d_45fb_9560_11aed0e6647a); +const XAPPCAPTURE: Guid = g(0xa4f1aee2_4bf1_4485_b008_a7c26d52ac27); /// XAsync + XTaskQueue + XThread (iid = clsid) pub const XASYNC: Guid = g(0x073b7dcb_1fcf_4030_94be_e3c9eb623428); /// classes that reach Xbox Live / the Store or take XCL's user handles: not available -const REFUSED: [(Guid, &str); 2] = [(XSTORE, "XStore"), (XUSER_DEVICE, "XUser (devices)")]; +const REFUSED: [(Guid, &str); 3] = [(XSTORE, "XStore"), (XAPPBROADCAST, "XAppBroadcast"), (XAPPCAPTURE, "XAppCapture")]; -/// names of the other classes, for the log -fn family(c: &Guid) -> &'static str { - match c.0 { - 0x073b7dcb => "XAsync/XTaskQueue/XThread", - 0x37e56907 => "XNetworking", - 0x95fd18d2 => "XGameInvite", - 0x8836fe87 => "XGameRuntimeFeature", - 0x0a2192aa => "(console only – stubs on PC)", - _ => "?", - } +/// rows of the GDK table: (function, class, interface, slot) +fn table() -> impl Iterator { + super::gdk_table::API.iter().map(|&(n, c, i, s)| (n, g(c), g(i), s as usize)) +} + +/// a class's name for the log: the prefix of its first function in the GDK table +fn family(c: &Guid) -> String { + let Some((n, ..)) = table().find(|r| r.1 == *c) else { return "?".into() }; + let end = n.char_indices().skip(1).filter(|(_, ch)| ch.is_ascii_uppercase()).nth(1).map_or(n.len(), |(k, _)| k); + n[..end].to_string() } const REGDB_E_CLASSNOTREG: HRESULT = 0x8004_0154_u32 as i32; @@ -201,7 +213,8 @@ pub unsafe extern "system" fn QueryApiImpl(clsid: *const Guid, iid: *const Guid, return REGDB_E_CLASSNOTREG; } if let Some(o) = own(&c, &i) { - note(c, i, format!("{}: XCL", o.iface.name)); + let known = o.iface.iids.contains(&i) || i == c; + note(c, i, format!("{}: XCL{}", o.iface.name, if known { "" } else { " (interface version not in the GDK table: the main vtable)" })); if !o.iface.forward.is_empty() && o.pc.load(Ordering::Acquire) == 0 { o.pc.store(pc_object(&c, &i).unwrap_or(0), Ordering::Release); } @@ -225,17 +238,35 @@ pub unsafe extern "system" fn QueryApiImpl(clsid: *const Guid, iid: *const Guid, // XCL's API objects // --------------------------------------------------------------------------------------- +/// One vtable of an XCL class. struct Iface { name: &'static str, clsid: Guid, - /// interface ids answered (the clsid itself too) - iids: &'static [Guid], + /// interface ids this vtable answers + iids: Vec, + /// the class's main vtable: also for interface ids the GDK table does not know + main: bool, + /// slot → function (GDK table) + names: Vec>, /// (slot, function): the API function itself, without `this` (a shim drops it) slots: Vec<(usize, usize)>, /// slots passed to the PC runtime's object of the same interface - forward: &'static [usize], - /// unimplemented slots that return bool: answer false - zero: &'static [usize], + forward: Vec, +} + +/// A class XCL answers for: its functions by GDK name, and the ones passed to the PC runtime. +struct Class { + name: &'static str, + clsid: Guid, + impls: Vec<(&'static str, usize)>, + forward: &'static [&'static str], +} + +/// Functions that return bool (an unimplemented one answers false). +fn returns_bool(name: &str) -> bool { + let rest = name.trim_start_matches('X'); + let verb = rest.char_indices().skip(1).find(|(_, ch)| ch.is_ascii_uppercase()).map_or("", |(k, _)| &rest[k..]); + verb.starts_with("Is") || verb.contains("Unregister") || name == "XPackageUpdateInstallationMonitor" || name == "XPackageUninstallPackage" } #[repr(C)] @@ -258,7 +289,7 @@ unsafe extern "system" fn query_interface(this: *const Obj, iid: *const Guid, ou return E_INVALIDARG; } let f = &(*this).iface; - if *iid == f.clsid || f.iids.contains(&*iid) { + if *iid == f.clsid || f.iids.contains(&*iid) || (f.main && own(&f.clsid, &*iid).is_some_and(|o| std::ptr::eq(o, this))) { *out = this as *mut c_void; return S_OK; } @@ -274,7 +305,10 @@ static UNIMPLEMENTED: Mutex> = Mutex::new(BTreeMap::new()) unsafe fn unknown_slot(this: *const Obj, slot: usize) -> usize { let f = &(*this).iface; - let key = format!("{}#{slot}", f.name); + let key = match f.names.get(slot).copied().flatten() { + Some(n) => n.to_string(), + None => format!("{}#{slot}", f.name), + }; let first = { let mut g = UNIMPLEMENTED.lock().unwrap(); let n = g.entry(key.clone()).or_insert(0); @@ -284,7 +318,7 @@ unsafe fn unknown_slot(this: *const Obj, slot: usize) -> usize { if first { crate::xlog_warn!("XGameRuntime: {key} – not supported (E_NOTIMPL)"); } - if f.zero.contains(&slot) { + if f.names.get(slot).copied().flatten().is_some_and(returns_bool) { 0 } else { E_NOTIMPL as u32 as usize @@ -340,7 +374,7 @@ fn object(iface: Iface) -> &'static Obj { v[0] = query_interface as usize; v[1] = add_ref as usize; v[2] = add_ref as usize; - for &k in iface.forward { + for &k in &iface.forward { v[k] = FORWARDS[k] as usize; } let mut targets = [0usize; SLOTS]; @@ -352,116 +386,241 @@ fn object(iface: Iface) -> &'static Obj { Box::leak(Box::new(Obj { vtbl, iface, pc: AtomicUsize::new(0), targets })) } +/// The vtables of a class from the GDK table: interface ids whose slots do not collide share +/// one (the one holding the class id itself, or the first, is the main one). +fn layout(c: Class) -> Vec { + let mut by_iid: BTreeMap> = BTreeMap::new(); + for (n, cl, i, slot) in table() { + if cl == c.clsid && slot < SLOTS { + by_iid.entry(i).or_default().push((slot, n)); + } + } + let mut order: Vec = by_iid.keys().copied().collect(); + order.sort_by_key(|i| (*i != c.clsid, by_iid[i].iter().map(|r| r.0).min())); + let mut groups: Vec<(Vec, Vec>)> = Vec::new(); + for i in order { + let rows = &by_iid[&i]; + let free = groups.iter().position(|(_, names)| rows.iter().all(|&(s, _)| names[s].is_none())); + let k = free.unwrap_or_else(|| { + groups.push((Vec::new(), vec![None; SLOTS])); + groups.len() - 1 + }); + groups[k].0.push(i); + for &(s, n) in rows { + groups[k].1[s] = Some(n); + } + } + groups + .into_iter() + .enumerate() + .map(|(k, (iids, names))| { + let slot_of = |f: &str| names.iter().position(|n| *n == Some(f)); + Iface { + name: c.name, + clsid: c.clsid, + main: k == 0, + slots: c.impls.iter().filter_map(|&(f, p)| Some((slot_of(f)?, p))).collect(), + forward: c.forward.iter().filter_map(|f| slot_of(f)).collect(), + iids, + names, + } + }) + .collect() +} + +fn classes() -> Vec { + vec![ + Class { name: "XUser", clsid: XUSER, impls: xuser(), forward: &[] }, + Class { name: "XUser (devices)", clsid: XUSER_DEVICE, impls: xuser_devices(), forward: &[] }, + Class { name: "XGameSave", clsid: XGAMESAVE, impls: xgamesave(), forward: &[] }, + Class { name: "XPersistentLocalStorage", clsid: XPLS, impls: xpls(), forward: &[] }, + Class { name: "XPackage", clsid: XPACKAGE, impls: xpackage(), forward: &[] }, + Class { name: "XGame", clsid: XGAME, impls: named![XGameGetXboxTitleId, XLaunchNewGame, XLaunchRestartOnCrash], forward: &[] }, + Class { name: "XSystem", clsid: XSYSTEM, impls: xsystem(), forward: &[] }, + Class { name: "XSystemAnalytics", clsid: XANALYTICS, impls: named![XSystemGetAnalyticsInfo], forward: &[] }, + Class { name: "XGameRuntimeFeature", clsid: XFEATURE, impls: named![XGameRuntimeIsFeatureAvailable], forward: &[] }, + Class { + name: "XDisplay", + clsid: XDISPLAY, + impls: vec![("XLaunchUri", launch_uri as usize), ("XDisplayAcquireTimeoutDeferral", display_deferral as usize), ("XDisplayCloseTimeoutDeferralHandle", nothing as usize)], + forward: &[], + }, + // telemetry: offline, accepted and dropped + Class { name: "XGameEvent", clsid: XGAMEEVENT, impls: vec![("XGameEventWrite", ok as usize)], forward: &[] }, + // dialogs without a user handle go to the PC runtime (message, error, text entry) + Class { + name: "XGameUi", + clsid: XGAMEUI, + impls: Vec::new(), + forward: &[ + "XGameUiShowMessageDialogAsync", + "XGameUiShowMessageDialogResult", + "XGameUiShowErrorDialogAsync", + "XGameUiShowErrorDialogResult", + "XGameUiShowTextEntryAsync", + "XGameUiShowTextEntryResultSize", + "XGameUiShowTextEntryResult", + ], + }, + ] +} + fn objects() -> &'static [&'static Obj] { static O: OnceLock> = OnceLock::new(); - O.get_or_init(|| { - vec![ - object(Iface { name: "XUser", clsid: XUSER, iids: &[XUSER_IID], slots: xuser_slots(), forward: &[], zero: &[] }), - object(Iface { name: "XUser (gamertag)", clsid: XUSER, iids: &[XUSER_GAMERTAG_IID], slots: vec![(3, XUserGetGamertag as usize)], forward: &[], zero: &[] }), - object(Iface { name: "XGameSave", clsid: XGAMESAVE, iids: &XGAMESAVE_IIDS, slots: xgamesave_slots(), forward: &[], zero: &[] }), - object(Iface { name: "XPackage", clsid: XPACKAGE, iids: &[XPACKAGE_IID], slots: xpackage_slots(), forward: &[], zero: &[22, 34] }), - object(Iface { - name: "XGame", - clsid: XGAME, - iids: &[XGAME_IID], - slots: vec![(3, XGameGetXboxTitleId as usize), (4, XLaunchNewGame as usize), (5, XLaunchRestartOnCrash as usize)], - forward: &[], - zero: &[], - }), - object(Iface { - name: "XSystem", - clsid: XSYSTEM, - iids: &[XSYSTEM_IID], - slots: vec![(3, XSystemGetConsoleId as usize), (4, XSystemGetXboxLiveSandboxId as usize)], - forward: &[5, 6, 7, 8, 9, 10, 11, 12, 13], - zero: &[], - }), - // dialogs without a user handle go to the PC runtime (message, error, text entry) - object(Iface { name: "XGameUi", clsid: XGAMEUI, iids: &[XGAMEUI_IID], slots: Vec::new(), forward: &[3, 4, 14, 15, 17, 18, 19], zero: &[] }), - ] - }) + O.get_or_init(|| classes().into_iter().flat_map(layout).map(object).collect()) } -/// XCL's object for (clsid, iid); the clsid as iid means the class's first interface. +/// XCL's object for (clsid, iid): the vtable holding that interface, else the class's main one. fn own(c: &Guid, i: &Guid) -> Option<&'static Obj> { let all = objects(); - all.iter().copied().find(|o| o.iface.clsid == *c && o.iface.iids.contains(i)).or_else(|| all.iter().copied().find(|o| o.iface.clsid == *c && *i == *c)) + all.iter().copied().find(|o| o.iface.clsid == *c && o.iface.iids.contains(i)).or_else(|| all.iter().copied().find(|o| o.iface.clsid == *c && o.iface.main)) } -fn xuser_slots() -> Vec<(usize, usize)> { +/// `(name, function)` pairs for functions named like their GDK function +macro_rules! named { + ($($f:ident),* $(,)?) => { + vec![$( (stringify!($f), $f as usize) ),*] + }; +} +use named; + +fn xuser() -> Vec<(&'static str, usize)> { + let mut v = named![ + XUserDuplicateHandle, + XUserCloseHandle, + XUserCompare, + XUserGetMaxUsers, + XUserAddAsync, + XUserAddResult, + XUserGetLocalId, + XUserGetId, + XUserGetIsGuest, + XUserGetState, + XUserGetGamertag, + XUserGetAgeGroup, + XUserCheckPrivilege, + XUserRegisterForChangeEvent, + XUserUnregisterForChangeEvent, + ]; + v.extend([ + ("XUserFindUserByLocalId", find_user as usize), + ("XUserFindUserById", find_user as usize), + ("XUserResolvePrivilegeWithUiAsync", resolve_privilege_async as usize), + ("XUserResolvePrivilegeWithUiResult", empty_result as usize), + ("XUserResolveIssueWithUiAsync", resolve_issue_async as usize), + ("XUserResolveIssueWithUiResult", empty_result as usize), + ("XUserResolveIssueWithUiUtf16Async", resolve_issue_async as usize), + ("XUserResolveIssueWithUiUtf16Result", empty_result as usize), + ("XUserGetSignOutDeferral", sign_out_deferral as usize), + ("XUserCloseSignOutDeferralHandle", nothing as usize), + ("XUserAddByIdWithUiAsync", add_by_id_async as usize), + ("XUserAddByIdWithUiResult", XUserAddResult as usize), + ("XUserIsStoreUser", no as usize), + ("XUserPlatformRemoteConnectSetEventHandlers", ok as usize), + ("XUserPlatformRemoteConnectCancelPrompt", ok as usize), + ("XUserPlatformSpopPromptSetEventHandlers", ok as usize), + ("XUserPlatformSpopPromptComplete", ok as usize), + ("XUserIsSignOutPresent", no as usize), + ("XUserSignOutAsync", sign_out_async as usize), + ("XUserSignOutResult", empty_result as usize), + ]); + v +} + +/// device association: the local user plays on every controller, no device is a user's +fn xuser_devices() -> Vec<(&'static str, usize)> { vec![ - (3, XUserDuplicateHandle as usize), - (4, XUserCloseHandle as usize), - (5, XUserCompare as usize), - (6, XUserGetMaxUsers as usize), - (7, XUserAddAsync as usize), - (8, XUserAddResult as usize), - (9, XUserGetLocalId as usize), - (10, find_user as usize), - (11, XUserGetId as usize), - (12, find_user as usize), - (13, XUserGetIsGuest as usize), - (14, XUserGetState as usize), - (19, XUserGetAgeGroup as usize), - (20, XUserCheckPrivilege as usize), - (33, XUserRegisterForChangeEvent as usize), - (34, XUserUnregisterForChangeEvent as usize), - (36, nothing as usize), - (42, no as usize), + ("XUserRegisterForDeviceAssociationChanged", register_token4 as usize), + ("XUserUnregisterForDeviceAssociationChanged", yes as usize), + ("XUserRegisterForDefaultAudioEndpointUtf16Changed", register_token4 as usize), + ("XUserUnregisterForDefaultAudioEndpointUtf16Changed", yes as usize), + ("XUserFindForDevice", user_not_found as usize), ] } -fn xgamesave_slots() -> Vec<(usize, usize)> { - vec![ - (3, XGameSaveInitializeProvider as usize), - (4, XGameSaveInitializeProviderAsync as usize), - (5, XGameSaveInitializeProviderResult as usize), - (6, XGameSaveCloseProvider as usize), - (7, XGameSaveGetRemainingQuota as usize), - (8, XGameSaveGetRemainingQuotaAsync as usize), - (9, XGameSaveGetRemainingQuotaResult as usize), - (10, XGameSaveDeleteContainer as usize), - (11, XGameSaveDeleteContainerAsync as usize), - (12, XGameSaveDeleteContainerResult as usize), - (13, XGameSaveGetContainerInfo as usize), - (14, XGameSaveEnumerateContainerInfo as usize), - (15, XGameSaveEnumerateContainerInfoByName as usize), - (16, XGameSaveCreateContainer as usize), - (17, XGameSaveCloseContainer as usize), - (18, XGameSaveEnumerateBlobInfo as usize), - (19, XGameSaveEnumerateBlobInfoByName as usize), - (20, XGameSaveReadBlobData as usize), - (21, XGameSaveReadBlobDataAsync as usize), - (22, XGameSaveReadBlobDataResult as usize), - (23, XGameSaveCreateUpdate as usize), - (24, XGameSaveCloseUpdate as usize), - (25, XGameSaveSubmitBlobWrite as usize), - (26, XGameSaveSubmitBlobDelete as usize), - (27, XGameSaveSubmitUpdate as usize), - (28, XGameSaveSubmitUpdateAsync as usize), - (29, XGameSaveSubmitUpdateResult as usize), - (30, XGameSaveFilesGetFolderWithUiAsync as usize), - (31, XGameSaveFilesGetFolderWithUiResult as usize), - (32, XGameSaveFilesGetRemainingQuota as usize), +fn xgamesave() -> Vec<(&'static str, usize)> { + named![ + XGameSaveInitializeProvider, + XGameSaveInitializeProviderAsync, + XGameSaveInitializeProviderResult, + XGameSaveCloseProvider, + XGameSaveGetRemainingQuota, + XGameSaveGetRemainingQuotaAsync, + XGameSaveGetRemainingQuotaResult, + XGameSaveDeleteContainer, + XGameSaveDeleteContainerAsync, + XGameSaveDeleteContainerResult, + XGameSaveGetContainerInfo, + XGameSaveEnumerateContainerInfo, + XGameSaveEnumerateContainerInfoByName, + XGameSaveCreateContainer, + XGameSaveCloseContainer, + XGameSaveEnumerateBlobInfo, + XGameSaveEnumerateBlobInfoByName, + XGameSaveReadBlobData, + XGameSaveReadBlobDataAsync, + XGameSaveReadBlobDataResult, + XGameSaveCreateUpdate, + XGameSaveCloseUpdate, + XGameSaveSubmitBlobWrite, + XGameSaveSubmitBlobDelete, + XGameSaveSubmitUpdate, + XGameSaveSubmitUpdateAsync, + XGameSaveSubmitUpdateResult, + XGameSaveFilesGetFolderWithUiAsync, + XGameSaveFilesGetFolderWithUiResult, + XGameSaveFilesGetRemainingQuota, ] } -fn xpackage_slots() -> Vec<(usize, usize)> { - vec![ - (3, XPackageGetCurrentProcessPackageIdentifier as usize), - (4, XPackageIsPackagedProcess as usize), - (5, XPackageCreateInstallationMonitor as usize), - (6, nothing as usize), - (7, XPackageGetInstallationProgress as usize), - (8, no as usize), - (9, XPackageRegisterInstallationProgressChanged as usize), - (10, XPackageUnregisterInstallationProgressChanged as usize), - (23, XPackageMount as usize), - (24, XPackageGetMountPathSize as usize), - (25, XPackageGetMountPath as usize), - (26, XPackageCloseMountHandle as usize), - (39, XPackageEnumeratePackages as usize), - ] +fn xpls() -> Vec<(&'static str, usize)> { + let mut v = named![XPersistentLocalStorageGetPathSize, XPersistentLocalStorageGetPath, XPersistentLocalStorageGetSpaceInfo]; + // no prompt to show: the space asked for is granted + v.extend([("XPersistentLocalStoragePromptUserForSpaceAsync", prompt_space_async as usize), ("XPersistentLocalStoragePromptUserForSpaceResult", empty_result as usize)]); + v +} + +fn xpackage() -> Vec<(&'static str, usize)> { + let mut v = named![ + XPackageGetCurrentProcessPackageIdentifier, + XPackageIsPackagedProcess, + XPackageCreateInstallationMonitor, + XPackageGetInstallationProgress, + XPackageRegisterInstallationProgressChanged, + XPackageUnregisterInstallationProgressChanged, + XPackageGetUserLocale, + XPackageFindChunkAvailability, + XPackageEstimateDownloadSize, + XPackageGetMountPathSize, + XPackageGetMountPath, + XPackageCloseMountHandle, + XPackageGetWriteStats, + XPackageGetPackageKind, + ]; + v.extend([ + ("XPackageCloseInstallationMonitorHandle", nothing as usize), + ("XPackageUpdateInstallationMonitor", no as usize), + ("XPackageEnumerateChunkAvailability", ok as usize), + ("XPackageChangeChunkInstallOrder", ok as usize), + ("XPackageInstallChunks", install_chunks as usize), + ("XPackageInstallChunksAsync", install_chunks_async as usize), + ("XPackageInstallChunksResult", install_chunks_result as usize), + ("XPackageUninstallChunks", ok as usize), + ("XPackageRegisterPackageInstalled", register_token4 as usize), + ("XPackageUnregisterPackageInstalled", yes as usize), + ("XPackageEnumerateFeatures", ok as usize), + ("XPackageUninstallPackage", no as usize), + ("XPackageMountWithUiAsync", mount_with_ui_async as usize), + ("XPackageMountWithUiResult", mount_with_ui_result as usize), + ("XPackageEnumeratePackages", enumerate_packages as usize), + ]); + v +} + +fn xsystem() -> Vec<(&'static str, usize)> { + let mut v = named![XSystemGetConsoleId, XSystemGetXboxLiveSandboxId, XSystemGetAppSpecificDeviceId]; + v.extend([("XSystemHandleTrack", ok as usize), ("XSystemIsHandleValid", yes as usize), ("XSystemAllowFullDownloadBandwidth", nothing as usize)]); + v } // --------------------------------------------------------------------------------------- @@ -474,6 +633,224 @@ unsafe extern "system" fn no(_a: usize) -> bool { false } +unsafe extern "system" fn yes() -> bool { + true +} + +unsafe extern "system" fn ok() -> HRESULT { + S_OK +} + +const E_GAMEUSER_DEFERRAL_NOT_AVAILABLE: HRESULT = 0x8924_5103_u32 as i32; +const E_GAMEUSER_USER_NOT_FOUND: HRESULT = 0x8924_5104_u32 as i32; + +static NEXT_TOKEN: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(1); + +/// Register*(queue, context, callback, token): a token, nothing will be called +unsafe extern "system" fn register_token4(_q: usize, _ctx: usize, _cb: usize, token: *mut u64) -> HRESULT { + if token.is_null() { + return E_INVALIDARG; + } + *token = NEXT_TOKEN.fetch_add(1, Ordering::Relaxed); + S_OK +} + +static EMPTY_ID: u8 = 0; + +/// an async call that completes at once with no result +unsafe fn completed(b: *mut XAsyncBlock) -> HRESULT { + begin_with(b, &EMPTY_ID as *const u8 as usize, || Ok(Vec::new())) +} + +/// the Result of such a call: its status +unsafe extern "system" fn empty_result(b: *mut XAsyncBlock) -> HRESULT { + XAsyncGetStatus(b, false) +} + +unsafe extern "system" fn resolve_privilege_async(_user: usize, _options: u32, _privilege: u32, b: *mut XAsyncBlock) -> HRESULT { + completed(b) +} + +unsafe extern "system" fn resolve_issue_async(_user: usize, _url: usize, b: *mut XAsyncBlock) -> HRESULT { + completed(b) +} + +unsafe extern "system" fn sign_out_async(_user: usize, b: *mut XAsyncBlock) -> HRESULT { + completed(b) +} + +unsafe extern "system" fn prompt_space_async(_bytes: u64, b: *mut XAsyncBlock) -> HRESULT { + completed(b) +} + +unsafe extern "system" fn sign_out_deferral(out: *mut usize) -> HRESULT { + if !out.is_null() { + *out = 0; + } + E_GAMEUSER_DEFERRAL_NOT_AVAILABLE +} + +/// XUserAddByIdWithUiAsync: the local user by either of its ids (XUserAddByIdWithUiResult = +/// XUserAddResult) +unsafe extern "system" fn add_by_id_async(id: u64, b: *mut XAsyncBlock) -> HRESULT { + let mut h = std::ptr::null_mut(); + if find_user(id, &mut h) < 0 { + return E_GAMEUSER_USER_NOT_FOUND; + } + XUserCloseHandle(h); + XUserAddAsync(0, b) +} + +unsafe extern "system" fn user_not_found(_device: usize, out: *mut usize) -> HRESULT { + if !out.is_null() { + *out = 0; + } + E_GAMEUSER_USER_NOT_FOUND +} + +/// Opening links on the title's behalf would act on the PC: refused. +unsafe extern "system" fn launch_uri(_user: usize, uri: *const u8) -> HRESULT { + crate::xlog_warn!("XLaunchUri({}) – refused", crate::util::from_cstr_ptr(uri).unwrap_or_default()); + E_NOTIMPL +} + +/// nothing to defer on a PC +unsafe extern "system" fn display_deferral(out: *mut usize) -> HRESULT { + if out.is_null() { + return E_INVALIDARG; + } + *out = 1; + S_OK +} + +/// XPackageInstallChunks(id, count, selectors, interval, suppress, queue, monitor): installed +unsafe extern "system" fn install_chunks(id: *const u8, count: u32, sel: *const c_void, interval: u32, _suppress: bool, queue: *mut c_void, out: *mut *const u64) -> HRESULT { + XPackageCreateInstallationMonitor(id, count, sel, interval, queue, out) +} + +static INSTALL_ID: u8 = 0; +static MOUNT_ID: u8 = 0; + +unsafe extern "system" fn install_chunks_async(_id: usize, _count: u32, _sel: usize, _interval: u32, _suppress: bool, b: *mut XAsyncBlock) -> HRESULT { + begin_with(b, &INSTALL_ID as *const u8 as usize, || Ok((&MONITOR as *const u64 as usize).to_le_bytes().to_vec())) +} + +unsafe extern "system" fn install_chunks_result(b: *mut XAsyncBlock, out: *mut usize) -> HRESULT { + XAsyncGetResult(b, &INSTALL_ID as *const u8 as *const c_void, 8, out as *mut c_void, std::ptr::null_mut()) +} + +unsafe extern "system" fn mount_with_ui_async(id: *const u8, b: *mut XAsyncBlock) -> HRESULT { + let mut m: *mut c_void = std::ptr::null_mut(); + let hr = XPackageMount(id, &mut m); + if hr < 0 { + return hr; + } + let m = m as usize; + begin_with(b, &MOUNT_ID as *const u8 as usize, move || Ok(m.to_le_bytes().to_vec())) +} + +unsafe extern "system" fn mount_with_ui_result(b: *mut XAsyncBlock, out: *mut usize) -> HRESULT { + XAsyncGetResult(b, &MOUNT_ID as *const u8 as *const c_void, 8, out as *mut c_void, std::ptr::null_mut()) +} + +/// XPackageDetails (XPackage.h) +#[repr(C)] +struct PackageDetails { + package_identifier: *const u8, + version: XVersion, + kind: u32, + display_name: *const u8, + description: *const u8, + publisher: *const u8, + store_id: *const u8, + installing: bool, + index: u32, + count: u32, + age_restricted: bool, + title_id: *const u8, +} + +/// XPackageEnumeratePackages(kind, scope, context, callback): the game itself (no DLC). +unsafe extern "system" fn enumerate_packages(kind: u32, _scope: u32, ctx: *mut c_void, cb: Option bool>) -> HRESULT { + let Some(cb) = cb else { return E_INVALIDARG }; + if kind != 0 { + return S_OK; + } + let c = |s: String| std::ffi::CString::new(s).unwrap_or_default(); + let id = c(package_identifier()); + let title = c(crate::state::boot().map(|b| b.title.clone()).unwrap_or_default()); + let title_id = c(crate::state::config().title_id.trim_start_matches("0x").to_ascii_uppercase()); + let empty = c(String::new()); + let d = PackageDetails { + package_identifier: id.as_ptr() as *const u8, + version: XVersion { major: 1, minor: 0, build: 0, revision: 0 }, + kind: 0, + display_name: title.as_ptr() as *const u8, + description: empty.as_ptr() as *const u8, + publisher: empty.as_ptr() as *const u8, + store_id: empty.as_ptr() as *const u8, + installing: false, + index: 0, + count: 1, + age_restricted: false, + title_id: title_id.as_ptr() as *const u8, + }; + cb(ctx, &d); + S_OK +} + +unsafe extern "system" fn XPackageGetUserLocale(size: usize, buf: *mut u8) -> HRESULT { + let mut w = [0u16; 85]; + let n = windows_sys::Win32::Globalization::GetUserDefaultLocaleName(w.as_mut_ptr(), w.len() as i32); + let loc = if n > 1 { String::from_utf16_lossy(&w[..n as usize - 1]) } else { "en-US".into() }; + crate::util::write_cstr_out(&loc, buf, size, std::ptr::null_mut()) +} + +/// every chunk is installed (XPackageChunkAvailability::Ready = 0) +unsafe extern "system" fn XPackageFindChunkAvailability(_id: usize, _count: u32, _sel: usize, out: *mut u32) -> HRESULT { + if out.is_null() { + return E_INVALIDARG; + } + *out = 0; + S_OK +} + +unsafe extern "system" fn XPackageEstimateDownloadSize(_id: usize, _count: u32, _sel: usize, size: *mut u64, confirm: *mut bool) -> HRESULT { + if !size.is_null() { + *size = 0; + } + if !confirm.is_null() { + *confirm = false; + } + S_OK +} + +/// XPackageWriteStats { interval, budget, elapsed, bytesWritten }: nothing measured +unsafe extern "system" fn XPackageGetWriteStats(out: *mut [u64; 4]) -> HRESULT { + if out.is_null() { + return E_INVALIDARG; + } + *out = [0; 4]; + S_OK +} + +/// XPackageKind::Game +unsafe extern "system" fn XPackageGetPackageKind(_id: usize, out: *mut u32) -> HRESULT { + if out.is_null() { + return E_INVALIDARG; + } + *out = 0; + S_OK +} + +/// A stable id per console and title. +unsafe extern "system" fn XSystemGetAppSpecificDeviceId(size: usize, buf: *mut u8, used: *mut usize) -> HRESULT { + use std::hash::{Hash, Hasher}; + let mut h = std::collections::hash_map::DefaultHasher::new(); + (crate::state::config().console_id.as_str(), crate::state::config().title_id.as_str()).hash(&mut h); + crate::util::write_cstr_out(&format!("{:016X}", h.finish()), buf, size, used) +} + /// XUserFindUserByLocalId / XUserFindUserById (slots 10 / 12): the local user by either id. unsafe extern "system" fn find_user(id: u64, out: *mut *mut c_void) -> HRESULT { let hr = XUserFindUserByLocalId(id, out); @@ -515,14 +892,13 @@ unsafe extern "system" fn XPackageCreateInstallationMonitor(_id: *const u8, _cou } /// XPackageInstallationProgress { totalBytes, installedBytes, launchBytes, launchable, -/// completed }: everything installed. The byte counts are 0x0101 so the flags still read -/// true if the struct has no launchBytes. +/// completed }: everything installed. unsafe extern "system" fn XPackageGetInstallationProgress(_monitor: *const u64, p: *mut u8) { if p.is_null() { return; } for k in 0..3 { - std::ptr::write_unaligned(p.add(8 * k) as *mut u64, 0x0101); + std::ptr::write_unaligned(p.add(8 * k) as *mut u64, 1); } *p.add(24) = 1; *p.add(25) = 1; @@ -617,6 +993,57 @@ mod tests { assert_eq!(&b[..4], &[0x77, 0xd1, 0xac, 0x01]); } + fn slot_in_table(name: &str) -> (Guid, Guid, usize) { + table().find(|r| r.0 == name).map(|r| (r.1, r.2, r.3)).unwrap_or_else(|| panic!("{name} not in the GDK table")) + } + + /// XCL's objects follow the GDK table: every implemented function is in its class; one + /// vtable for the interface versions that share slots, its own for the gamertag one; an + /// interface id the table does not know gets the main vtable. The table agrees with the + /// slots the thunks in the game's DLLs use (argument / result widths, see HANDOFF). + #[test] + fn vtables_follow_the_gdk_table() { + for c in classes() { + for (f, _) in c.impls.iter().map(|x| (x.0, x.1)).chain(c.forward.iter().map(|f| (*f, 0))) { + assert_eq!(slot_in_table(f).0, c.clsid, "{f} is not a {} function", c.name); + } + } + // slots the game's own thunks call (libHttpClient.GDK / XCurl), matched by signature + for (f, slot) in [ + ("XUserAddAsync", 7), + ("XUserGetState", 14), + ("XUserCheckPrivilege", 20), + ("XUserUnregisterForChangeEvent", 34), + ("XUserIsStoreUser", 42), + ("XGameSaveCreateContainer", 16), + ("XGameSaveCloseContainer", 17), + ("XGameSaveReadBlobData", 20), + ("XPackageInstallChunksAsync", 16), + ("XPackageEnumeratePackages", 39), + ("XPersistentLocalStorageGetPath", 4), + ("XSystemGetAppSpecificDeviceId", 5), + ("XGameGetXboxTitleId", 3), + ("XAsyncBegin", 7), + ("XTaskQueueCreate", 12), + ] { + assert_eq!(slot_in_table(f).2, slot, "{f}"); + } + let main = own(&XUSER, &XUSER).unwrap(); + assert!(std::ptr::eq(own(&XUSER, &g(0x26f3c674_a2fe_44fa_b6c4_a323bc94ff53)).unwrap(), main), "a later XUser interface: the same vtable"); + assert!(std::ptr::eq(own(&XUSER, &g(0x5131d685_4394_4ee6_8c18_bfb5d4aef1ff)).unwrap(), main)); + let gt = own(&XUSER, &XUSER_GAMERTAG_IID).unwrap(); + assert!(!std::ptr::eq(gt, main), "XUserGetGamertag has its own vtable"); + assert_eq!(gt.targets[3], XUserGetGamertag as usize); + assert_eq!(main.targets[7], XUserAddAsync as usize); + let pkg = own(&XPACKAGE, &XPACKAGE_OLD_IID).expect("an XPackage interface id the table does not know"); + assert!(pkg.iface.main); + assert_eq!(pkg.targets[slot_in_table("XPackageEnumeratePackages").2], enumerate_packages as usize); + let pls = own(&XPLS, &g(0x41a4e10c_5a7e_41d9_8c37_37bde62a07d6)).expect("persistent local storage is XCL's"); + assert_eq!(pls.targets[4], XPersistentLocalStorageGetPath as usize); + assert!(own(&XSTORE, &XSTORE).is_none()); + assert!(returns_bool("XUserIsStoreUser") && returns_bool("XPackageUnregisterPackageInstalled") && !returns_bool("XUserGetState")); + } + /// The thunk protocol end to end on the PC runtime: XUser and XGameSave are XCL's objects, /// their async calls complete on the PC runtime's task queues; XStore is refused; XAsync /// comes from the PC runtime. @@ -635,7 +1062,7 @@ mod tests { let get_status: unsafe extern "system" fn(*mut c_void, *mut XAsyncBlock, bool) -> HRESULT = slot(xa, 3); // XUserAddAsync / Result through the vtable, completed on the PC process queue - let (hr, u) = query(XUSER, XUSER_IID); + let (hr, u) = query(XUSER, g(0x26f3c674_a2fe_44fa_b6c4_a323bc94ff53)); assert_eq!(hr, S_OK); let add: unsafe extern "system" fn(*mut c_void, u32, *mut XAsyncBlock) -> HRESULT = slot(u, 7); let result: unsafe extern "system" fn(*mut c_void, *mut XAsyncBlock, *mut *mut c_void) -> HRESULT = slot(u, 8); @@ -655,10 +1082,10 @@ mod tests { // an unimplemented slot answers E_NOTIMPL and is reported let token: unsafe extern "system" fn(*mut c_void) -> HRESULT = slot(u, 23); assert_eq!(token(u), E_NOTIMPL); - assert!(stats().unimplemented.contains_key("XUser#23")); + assert!(stats().unimplemented.contains_key("XUserGetTokenAndSignatureAsync"), "{:?}", stats().unimplemented); // XGameSave: provider (async), container, write a blob, read it back (async) - let (_, s) = query(XGAMESAVE, XGAMESAVE_IIDS[0]); + let (_, s) = query(XGAMESAVE, g(0x1bfff3af_f14a_40a3_8e35_9ada906593f9)); let init: unsafe extern "system" fn(*mut c_void, *mut c_void, *const u8, bool, *mut XAsyncBlock) -> HRESULT = slot(s, 4); let init_r: unsafe extern "system" fn(*mut c_void, *mut XAsyncBlock, *mut *mut Provider) -> HRESULT = slot(s, 5); let mut b: XAsyncBlock = std::mem::zeroed(); @@ -688,6 +1115,14 @@ mod tests { assert_eq!(n, 1); XGameSaveCloseContainer(c); XGameSaveCloseProvider(p); + + // persistent local storage is XCL's (the PC runtime fails it for an unpackaged process) + let (hr, pls) = query(XPLS, g(0x41a4e10c_5a7e_41d9_8c37_37bde62a07d6)); + assert_eq!(hr, S_OK); + let size: unsafe extern "system" fn(*mut c_void, *mut usize) -> HRESULT = slot(pls, 3); + let mut n = 0usize; + assert_eq!(size(pls, &mut n), S_OK); + assert!(n > 1); // completion callbacks run on the PC queue's threads, after the status for _ in 0..200 { if DONE.load(Ordering::SeqCst) >= 1 { diff --git a/crates/xcl/src/hle/xgameruntime/gdk_table.rs b/crates/xcl/src/hle/xgameruntime/gdk_table.rs new file mode 100644 index 0000000..4ae0e5c --- /dev/null +++ b/crates/xcl/src/hle/xgameruntime/gdk_table.rs @@ -0,0 +1,403 @@ +//! Generated by scripts/gen_gdk_table.py – do not edit. +//! The GDK runtime's functions as the public PC GDK's xgameruntime.lib (261000/xgameruntime.lib) calls them: +//! the (class, interface) its thunk asks QueryApiImpl for and the vtable slot it calls. + +/// (function, class id, interface id, slot) +pub static API: &[(&str, u128, u128, u8)] = &[ + ("XUserDuplicateHandle", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 3), + ("XUserCloseHandle", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 4), + ("XUserCompare", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 5), + ("XUserGetMaxUsers", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 6), + ("XUserAddAsync", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 7), + ("XUserAddResult", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 8), + ("XUserGetLocalId", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 9), + ("XUserFindUserByLocalId", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 10), + ("XUserGetId", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 11), + ("XUserFindUserById", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 12), + ("XUserGetIsGuest", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 13), + ("XUserGetState", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 14), + ("XUserGetGamerPictureAsync", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 16), + ("XUserGetGamerPictureResultSize", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 17), + ("XUserGetGamerPictureResult", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 18), + ("XUserGetAgeGroup", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 19), + ("XUserCheckPrivilege", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 20), + ("XUserResolvePrivilegeWithUiAsync", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 21), + ("XUserResolvePrivilegeWithUiResult", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 22), + ("XUserGetTokenAndSignatureAsync", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 23), + ("XUserGetTokenAndSignatureResultSize", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 24), + ("XUserGetTokenAndSignatureResult", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 25), + ("XUserGetTokenAndSignatureUtf16Async", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 26), + ("XUserGetTokenAndSignatureUtf16ResultSize", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 27), + ("XUserGetTokenAndSignatureUtf16Result", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 28), + ("XUserResolveIssueWithUiAsync", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 29), + ("XUserResolveIssueWithUiResult", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 30), + ("XUserResolveIssueWithUiUtf16Async", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 31), + ("XUserResolveIssueWithUiUtf16Result", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 32), + ("XUserRegisterForChangeEvent", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 33), + ("XUserUnregisterForChangeEvent", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 34), + ("XUserGetSignOutDeferral", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 35), + ("XUserCloseSignOutDeferralHandle", 0x01acd17791f94763a38eccbb55ce32e0, 0x01acd17791f94763a38eccbb55ce32e0, 36), + ("XUserIsStoreUser", 0x01acd17791f94763a38eccbb55ce32e0, 0x079415e36727437f8e9d8f8f9b2439f7, 42), + ("XUserPlatformRemoteConnectSetEventHandlers", 0x01acd17791f94763a38eccbb55ce32e0, 0x26f3c674a2fe44fab6c4a323bc94ff53, 43), + ("XUserPlatformRemoteConnectCancelPrompt", 0x01acd17791f94763a38eccbb55ce32e0, 0x26f3c674a2fe44fab6c4a323bc94ff53, 44), + ("XUserPlatformSpopPromptSetEventHandlers", 0x01acd17791f94763a38eccbb55ce32e0, 0x26f3c674a2fe44fab6c4a323bc94ff53, 45), + ("XUserPlatformSpopPromptComplete", 0x01acd17791f94763a38eccbb55ce32e0, 0x26f3c674a2fe44fab6c4a323bc94ff53, 46), + ("XUserIsSignOutPresent", 0x01acd17791f94763a38eccbb55ce32e0, 0x5131d68543944ee68c18bfb5d4aef1ff, 47), + ("XUserSignOutAsync", 0x01acd17791f94763a38eccbb55ce32e0, 0x5131d68543944ee68c18bfb5d4aef1ff, 48), + ("XUserSignOutResult", 0x01acd17791f94763a38eccbb55ce32e0, 0x5131d68543944ee68c18bfb5d4aef1ff, 49), + ("XUserGetGamertag", 0x01acd17791f94763a38eccbb55ce32e0, 0xcef4fac076764a94a1194c43f9eb5b74, 3), + ("XUserAddByIdWithUiAsync", 0x01acd17791f94763a38eccbb55ce32e0, 0xeb9bf94818dc4d82bbcc40e0a809c4c0, 37), + ("XUserAddByIdWithUiResult", 0x01acd17791f94763a38eccbb55ce32e0, 0xeb9bf94818dc4d82bbcc40e0a809c4c0, 38), + ("XDisplayTryEnableHdrMode", 0x03f0fe74fdd94e5cb630f9339c47acc5, 0x35f07670706e4bfb9476090798c5ebf3, 4), + ("XGameInviteRegisterForPendingEvent", 0x0651aae240124077bf848b9097090e2c, 0x014d1cc3bcfe41ffb2f0e1ef07155828, 5), + ("XGameInviteUnregisterForPendingEvent", 0x0651aae240124077bf848b9097090e2c, 0x014d1cc3bcfe41ffb2f0e1ef07155828, 6), + ("XGameInviteAcceptPendingInvite", 0x0651aae240124077bf848b9097090e2c, 0x014d1cc3bcfe41ffb2f0e1ef07155828, 7), + ("XGameInviteRegisterForEvent", 0x0651aae240124077bf848b9097090e2c, 0x0651aae240124077bf848b9097090e2c, 3), + ("XGameInviteUnregisterForEvent", 0x0651aae240124077bf848b9097090e2c, 0x0651aae240124077bf848b9097090e2c, 4), + ("XAsyncGetStatus", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 3), + ("XAsyncGetResultSize", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 4), + ("XAsyncCancel", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 5), + ("XAsyncRun", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 6), + ("XAsyncBegin", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 7), + ("XAsyncSchedule", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 9), + ("XAsyncComplete", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 10), + ("XAsyncGetResult", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 11), + ("XTaskQueueCreate", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 12), + ("XTaskQueueCreateComposite", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 13), + ("XTaskQueueGetPort", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 14), + ("XTaskQueueDuplicateHandle", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 15), + ("XTaskQueueDispatch", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 16), + ("XTaskQueueCloseHandle", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 17), + ("XTaskQueueSubmitCallback", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 18), + ("XTaskQueueSubmitDelayedCallback", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 19), + ("XTaskQueueRegisterWaiter", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 20), + ("XTaskQueueUnregisterWaiter", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 21), + ("XTaskQueueTerminate", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 22), + ("XTaskQueueRegisterMonitor", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 23), + ("XTaskQueueUnregisterMonitor", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 24), + ("XTaskQueueGetCurrentProcessTaskQueue", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 25), + ("XTaskQueueSetCurrentProcessTaskQueue", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 26), + ("XThreadSetTimeSensitive", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 27), + ("XThreadVerifyNotTimeSensitive", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 28), + ("XThreadAssertNotTimeSensitive", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 29), + ("XThreadIsTimeSensitive", 0x073b7dcb1fcf403094bee3c9eb623428, 0x073b7dcb1fcf403094bee3c9eb623428, 30), + ("XGameStreamingInitialize", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 3), + ("XGameStreamingUninitialize", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 4), + ("XGameStreamingIsStreaming", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 5), + ("XGameStreamingRegisterClientPropertiesChanged", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 6), + ("XGameStreamingUnregisterClientPropertiesChanged", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 7), + ("XGameStreamingGetStreamPhysicalDimensions", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 8), + ("XGameStreamingGetClientCount", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 9), + ("XGameStreamingGetClients", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 10), + ("XGameStreamingGetConnectionState", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 11), + ("XGameStreamingRegisterConnectionStateChanged", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 12), + ("XGameStreamingUnregisterConnectionStateChanged", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 13), + ("XGameStreamingGetStreamAddedLatency", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 14), + ("XGameStreamingGetServerLocationNameSize", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 15), + ("XGameStreamingGetServerLocationName", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 16), + ("XGameStreamingHideTouchControls", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 17), + ("XGameStreamingShowTouchControlLayout", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 18), + ("XGameStreamingHideTouchControlsOnClient", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 19), + ("XGameStreamingShowTouchControlLayoutOnClient", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 20), + ("XGameStreamingIsTouchInputEnabled", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 21), + ("XGameStreamingGetLastFrameDisplayed", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 22), + ("XGameStreamingGetAssociatedFrame", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 23), + ("XGameStreamingGetGamepadPhysicality", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 24), + ("XGameStreamingUpdateTouchControlsState", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 25), + ("XGameStreamingUpdateTouchControlsStateOnClient", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 26), + ("XGameStreamingShowTouchControlsWithStateUpdate", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 27), + ("XGameStreamingShowTouchControlsWithStateUpdateOnClient", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 28), + ("XGameStreamingGetTouchBundleVersionNameSize", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 29), + ("XGameStreamingGetTouchBundleVersion", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 30), + ("XGameStreamingGetClientIPAddress", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 31), + ("XGameStreamingGetSessionId", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 32), + ("XGameStreamingGetDisplayDetails", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 33), + ("XGameStreamingSetResolution", 0x0a2192aab2d54d5883be383b6d80799e, 0x57786622660546d0b9170f22bbcd9c52, 34), + ("XGameStreamingSendDebugMessageToClient", 0x0a2192aab2d54d5883be383b6d80799e, 0xaebdfe78439449ffba3a001956457044, 6), + ("XStoreAcquireLicenseForDurablesAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0x2d42fea5e71d4b7697cdc50afbb3ae5d, 71), + ("XStoreAcquireLicenseForDurablesResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0x2d42fea5e71d4b7697cdc50afbb3ae5d, 72), + ("XStoreQueryAssociatedProductsForStoreIdAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0x5c48dedf0b674492a4b56829b8e796e1, 77), + ("XStoreQueryAssociatedProductsForStoreIdResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0x5c48dedf0b674492a4b56829b8e796e1, 78), + ("XStoreQueryPackageUpdatesAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0x5c48dedf0b674492a4b56829b8e796e1, 79), + ("XStoreQueryPackageUpdatesResultCount", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0x5c48dedf0b674492a4b56829b8e796e1, 80), + ("XStoreQueryPackageUpdatesResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0x5c48dedf0b674492a4b56829b8e796e1, 81), + ("XStoreIsAvailabilityPurchasable", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0x60b09f4e1b8545b1826c169118e230e1, 70), + ("XStoreCreateContext", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 3), + ("XStoreCloseContextHandle", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 4), + ("XStoreQueryAssociatedProductsAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 5), + ("XStoreQueryAssociatedProductsResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 6), + ("XStoreQueryProductsAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 7), + ("XStoreQueryProductsResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 8), + ("XStoreQueryEntitledProductsAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 9), + ("XStoreQueryEntitledProductsResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 10), + ("XStoreQueryProductForCurrentGameAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 11), + ("XStoreQueryProductForCurrentGameResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 12), + ("XStoreQueryProductForPackageAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 13), + ("XStoreQueryProductForPackageResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 14), + ("XStoreEnumerateProductsQuery", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 15), + ("XStoreProductsQueryHasMorePages", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 16), + ("XStoreProductsQueryNextPageAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 17), + ("XStoreProductsQueryNextPageResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 18), + ("XStoreCloseProductsQueryHandle", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 19), + ("XStoreAcquireLicenseForPackageAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 20), + ("XStoreAcquireLicenseForPackageResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 21), + ("XStoreIsLicenseValid", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 22), + ("XStoreCloseLicenseHandle", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 23), + ("XStoreCanAcquireLicenseForStoreIdAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 24), + ("XStoreCanAcquireLicenseForStoreIdResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 25), + ("XStoreCanAcquireLicenseForPackageAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 26), + ("XStoreCanAcquireLicenseForPackageResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 27), + ("XStoreQueryGameLicenseAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 28), + ("XStoreQueryGameLicenseResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 29), + ("XStoreQueryAddOnLicensesAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 30), + ("XStoreQueryAddOnLicensesResultCount", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 31), + ("XStoreQueryAddOnLicensesResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 32), + ("XStoreQueryConsumableBalanceRemainingAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 33), + ("XStoreQueryConsumableBalanceRemainingResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 34), + ("XStoreReportConsumableFulfillmentAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 35), + ("XStoreReportConsumableFulfillmentResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 36), + ("XStoreGetUserCollectionsIdAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 37), + ("XStoreGetUserCollectionsIdResultSize", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 38), + ("XStoreGetUserCollectionsIdResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 39), + ("XStoreGetUserPurchaseIdAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 40), + ("XStoreGetUserPurchaseIdResultSize", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 41), + ("XStoreGetUserPurchaseIdResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 42), + ("XStoreQueryLicenseTokenAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 43), + ("XStoreQueryLicenseTokenResultSize", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 44), + ("XStoreQueryLicenseTokenResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 45), + ("XStoreShowPurchaseUIAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 49), + ("XStoreShowPurchaseUIResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 50), + ("XStoreShowRateAndReviewUIAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 51), + ("XStoreShowRateAndReviewUIResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 52), + ("XStoreShowRedeemTokenUIAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 53), + ("XStoreShowRedeemTokenUIResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 54), + ("XStoreQueryGameAndDlcPackageUpdatesAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 55), + ("XStoreQueryGameAndDlcPackageUpdatesResultCount", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 56), + ("XStoreQueryGameAndDlcPackageUpdatesResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 57), + ("XStoreDownloadPackageUpdatesAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 58), + ("XStoreDownloadPackageUpdatesResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 59), + ("XStoreDownloadAndInstallPackageUpdatesAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 60), + ("XStoreDownloadAndInstallPackageUpdatesResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 61), + ("XStoreDownloadAndInstallPackagesAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 62), + ("XStoreDownloadAndInstallPackagesResultCount", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 63), + ("XStoreDownloadAndInstallPackagesResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 64), + ("XStoreQueryPackageIdentifier", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 65), + ("XStoreRegisterGameLicenseChanged", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 66), + ("XStoreUnregisterGameLicenseChanged", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 67), + ("XStoreRegisterPackageLicenseLost", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 68), + ("XStoreUnregisterPackageLicenseLost", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 69), + ("XStoreShowAssociatedProductsUIAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 73), + ("XStoreShowAssociatedProductsUIResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 74), + ("XStoreShowProductPageUIAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 75), + ("XStoreShowProductPageUIResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 76), + ("XStoreShowGiftingUIAsync", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 82), + ("XStoreShowGiftingUIResult", 0x0dd112ac7c24448cb92b3960fb5bd30c, 0xb09d803c24144a0582c666dfdc9e9a44, 83), + ("XAppBroadcastIsAppBroadcasting", 0x186d5592a72d45fb956011aed0e6647a, 0x186d5592a72d45fb956011aed0e6647a, 3), + ("XAppBroadcastShowUI", 0x186d5592a72d45fb956011aed0e6647a, 0x186d5592a72d45fb956011aed0e6647a, 4), + ("XAppBroadcastGetStatus", 0x186d5592a72d45fb956011aed0e6647a, 0x186d5592a72d45fb956011aed0e6647a, 5), + ("XAppBroadcastRegisterIsAppBroadcastingChanged", 0x186d5592a72d45fb956011aed0e6647a, 0x186d5592a72d45fb956011aed0e6647a, 6), + ("XAppBroadcastUnregisterIsAppBroadcastingChanged", 0x186d5592a72d45fb956011aed0e6647a, 0x186d5592a72d45fb956011aed0e6647a, 7), + ("XAppCaptureMetadataAddStringEvent", 0x186d5592a72d45fb956011aed0e6647a, 0x186d5592a72d45fb956011aed0e6647a, 8), + ("XAppCaptureMetadataAddInt32Event", 0x186d5592a72d45fb956011aed0e6647a, 0x186d5592a72d45fb956011aed0e6647a, 9), + ("XAppCaptureMetadataAddDoubleEvent", 0x186d5592a72d45fb956011aed0e6647a, 0x186d5592a72d45fb956011aed0e6647a, 10), + ("XAppCaptureMetadataStartStringState", 0x186d5592a72d45fb956011aed0e6647a, 0x186d5592a72d45fb956011aed0e6647a, 11), + ("XAppCaptureMetadataStartInt32State", 0x186d5592a72d45fb956011aed0e6647a, 0x186d5592a72d45fb956011aed0e6647a, 12), + ("XAppCaptureMetadataStartDoubleState", 0x186d5592a72d45fb956011aed0e6647a, 0x186d5592a72d45fb956011aed0e6647a, 13), + ("XAppCaptureMetadataStopState", 0x186d5592a72d45fb956011aed0e6647a, 0x186d5592a72d45fb956011aed0e6647a, 14), + ("XAppCaptureMetadataStopAllStates", 0x186d5592a72d45fb956011aed0e6647a, 0x186d5592a72d45fb956011aed0e6647a, 15), + ("XAppCaptureMetadataRemainingStorageBytesAvailable", 0x186d5592a72d45fb956011aed0e6647a, 0x186d5592a72d45fb956011aed0e6647a, 16), + ("XAppCaptureRegisterMetadataPurged", 0x186d5592a72d45fb956011aed0e6647a, 0x186d5592a72d45fb956011aed0e6647a, 17), + ("XAppCaptureUnRegisterMetadataPurged", 0x186d5592a72d45fb956011aed0e6647a, 0x186d5592a72d45fb956011aed0e6647a, 18), + ("XLaunchUri", 0x1b339674328d4283a2003171f18d3639, 0x1b339674328d4283a2003171f18d3639, 3), + ("XDisplayAcquireTimeoutDeferral", 0x1b339674328d4283a2003171f18d3639, 0x1b339674328d4283a2003171f18d3639, 4), + ("XDisplayCloseTimeoutDeferralHandle", 0x1b339674328d4283a2003171f18d3639, 0x1b339674328d4283a2003171f18d3639, 5), + ("XNetworkingQueryPreferredLocalUdpMultiplayerPort", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 3), + ("XNetworkingQueryPreferredLocalUdpMultiplayerPortAsync", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 4), + ("XNetworkingQueryPreferredLocalUdpMultiplayerPortAsyncResult", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 5), + ("XNetworkingRegisterPreferredLocalUdpMultiplayerPortChanged", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 6), + ("XNetworkingUnregisterPreferredLocalUdpMultiplayerPortChanged", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 7), + ("XNetworkingQuerySecurityInformationForUrlAsync", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 8), + ("XNetworkingQuerySecurityInformationForUrlAsyncResultSize", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 9), + ("XNetworkingQuerySecurityInformationForUrlAsyncResult", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 10), + ("XNetworkingQuerySecurityInformationForUrlUtf16Async", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 11), + ("XNetworkingQuerySecurityInformationForUrlUtf16AsyncResultSize", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 12), + ("XNetworkingQuerySecurityInformationForUrlUtf16AsyncResult", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 13), + ("XNetworkingVerifyServerCertificate", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 14), + ("XNetworkingGetConnectivityHint", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 15), + ("XNetworkingRegisterConnectivityHintChanged", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 16), + ("XNetworkingUnregisterConnectivityHintChanged", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 17), + ("XNetworkingQueryConfigurationSetting", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 18), + ("XNetworkingSetConfigurationSetting", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 19), + ("XNetworkingQueryStatistics", 0x37e569072f1041e8b72f36edb185331a, 0xbf2346b239af4658b5ea44713c7e83b3, 20), + ("XClosedCaptionGetProperties", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 3), + ("XClosedCaptionSetEnabled", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 4), + ("XHighContrastGetMode", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 5), + ("XSpeechToTextSetPositionHint", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 6), + ("XSpeechToTextSendString", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 7), + ("XSpeechSynthesizerEnumerateInstalledVoices", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 8), + ("XSpeechSynthesizerCreate", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 9), + ("XSpeechSynthesizerCloseHandle", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 10), + ("XSpeechSynthesizerSetDefaultVoice", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 11), + ("XSpeechSynthesizerSetCustomVoice", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 12), + ("XSpeechSynthesizerCreateStreamFromText", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 13), + ("XSpeechSynthesizerCloseStreamHandle", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 14), + ("XSpeechSynthesizerGetStreamDataSize", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 15), + ("XSpeechSynthesizerGetStreamData", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 16), + ("XSpeechToTextBeginHypothesisString", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 17), + ("XSpeechToTextUpdateHypothesisString", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 18), + ("XSpeechToTextFinalizeHypothesisString", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 19), + ("XSpeechToTextCancelHypothesisString", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 20), + ("XSpeechSynthesizerCreateStreamFromSsml", 0x3e241977623741e98559102c2d9983f1, 0xd722b3738c4d46929e51d6ad9b37aa7d, 21), + ("XGameSaveInitializeProvider", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 3), + ("XGameSaveInitializeProviderAsync", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 4), + ("XGameSaveInitializeProviderResult", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 5), + ("XGameSaveCloseProvider", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 6), + ("XGameSaveGetRemainingQuota", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 7), + ("XGameSaveGetRemainingQuotaAsync", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 8), + ("XGameSaveGetRemainingQuotaResult", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 9), + ("XGameSaveDeleteContainer", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 10), + ("XGameSaveDeleteContainerAsync", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 11), + ("XGameSaveDeleteContainerResult", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 12), + ("XGameSaveGetContainerInfo", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 13), + ("XGameSaveEnumerateContainerInfo", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 14), + ("XGameSaveEnumerateContainerInfoByName", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 15), + ("XGameSaveCreateContainer", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 16), + ("XGameSaveCloseContainer", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 17), + ("XGameSaveEnumerateBlobInfo", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 18), + ("XGameSaveEnumerateBlobInfoByName", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 19), + ("XGameSaveReadBlobData", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 20), + ("XGameSaveReadBlobDataAsync", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 21), + ("XGameSaveReadBlobDataResult", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 22), + ("XGameSaveCreateUpdate", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 23), + ("XGameSaveCloseUpdate", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 24), + ("XGameSaveSubmitBlobWrite", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 25), + ("XGameSaveSubmitBlobDelete", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 26), + ("XGameSaveSubmitUpdate", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 27), + ("XGameSaveSubmitUpdateAsync", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 28), + ("XGameSaveSubmitUpdateResult", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 29), + ("XGameSaveFilesGetFolderWithUiAsync", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 30), + ("XGameSaveFilesGetFolderWithUiResult", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 31), + ("XGameSaveFilesGetRemainingQuota", 0x704c3f58e6294cc2b19730511b996fe2, 0x1bfff3aff14a40a38e359ada906593f9, 32), + ("XUserFindForDevice", 0x7d82499710dc45ab86b72737767c0bf1, 0x0cc6a956e7e14fdf93419d5da649ebc8, 3), + ("XUserRegisterForDeviceAssociationChanged", 0x7d82499710dc45ab86b72737767c0bf1, 0x0cc6a956e7e14fdf93419d5da649ebc8, 4), + ("XUserUnregisterForDeviceAssociationChanged", 0x7d82499710dc45ab86b72737767c0bf1, 0x0cc6a956e7e14fdf93419d5da649ebc8, 5), + ("XUserGetDefaultAudioEndpointUtf16", 0x7d82499710dc45ab86b72737767c0bf1, 0x0cc6a956e7e14fdf93419d5da649ebc8, 6), + ("XUserRegisterForDefaultAudioEndpointUtf16Changed", 0x7d82499710dc45ab86b72737767c0bf1, 0x0cc6a956e7e14fdf93419d5da649ebc8, 7), + ("XUserUnregisterForDefaultAudioEndpointUtf16Changed", 0x7d82499710dc45ab86b72737767c0bf1, 0x0cc6a956e7e14fdf93419d5da649ebc8, 8), + ("XUserFindControllerForUserWithUiAsync", 0x7d82499710dc45ab86b72737767c0bf1, 0x0cc6a956e7e14fdf93419d5da649ebc8, 9), + ("XUserFindControllerForUserWithUiResult", 0x7d82499710dc45ab86b72737767c0bf1, 0x0cc6a956e7e14fdf93419d5da649ebc8, 10), + ("XGameActivationRegisterForEvent", 0x7f0fe8b8e07549ab9aa7a1e065489a9e, 0x2e4f76fe0fc7461eab4da4499434c3cf, 3), + ("XGameActivationUnregisterForEvent", 0x7f0fe8b8e07549ab9aa7a1e065489a9e, 0x2e4f76fe0fc7461eab4da4499434c3cf, 4), + ("XGameActivationAcceptPendingInvite", 0x7f0fe8b8e07549ab9aa7a1e065489a9e, 0x2e4f76fe0fc7461eab4da4499434c3cf, 5), + ("XGameRuntimeIsFeatureAvailable", 0x8836fe87edb94fe38dad05f0d2cd5b40, 0x8836fe87edb94fe38dad05f0d2cd5b40, 3), + ("XErrorReport", 0x8ca467f722e840968456bb8aa13f79d8, 0x8ca467f722e840968456bb8aa13f79d8, 3), + ("XErrorSetCallback", 0x8ca467f722e840968456bb8aa13f79d8, 0x8ca467f722e840968456bb8aa13f79d8, 4), + ("XErrorSetOptions", 0x8ca467f722e840968456bb8aa13f79d8, 0x8ca467f722e840968456bb8aa13f79d8, 5), + ("XGameProtocolRegisterForActivation", 0x95fd18d274dd4d7caa1b0b51827665d6, 0x026b010c06c34cddbbcb43f229db1cff, 3), + ("XGameProtocolUnregisterForActivation", 0x95fd18d274dd4d7caa1b0b51827665d6, 0x026b010c06c34cddbbcb43f229db1cff, 4), + ("XGameGetXboxTitleId", 0x973a344e24bf4d0f845756c534892b29, 0x2549f14264194a0697b5931aab7c2f34, 3), + ("XLaunchNewGame", 0x973a344e24bf4d0f845756c534892b29, 0x2549f14264194a0697b5931aab7c2f34, 4), + ("XLaunchRestartOnCrash", 0x973a344e24bf4d0f845756c534892b29, 0x2549f14264194a0697b5931aab7c2f34, 5), + ("XAppCaptureTakeDiagnosticScreenshot", 0xa4f1aee24bf14485b008a7c26d52ac27, 0x22e672d7b4e3406cbd508f0d25236f9e, 3), + ("XAppCaptureRecordDiagnosticClip", 0xa4f1aee24bf14485b008a7c26d52ac27, 0x22e672d7b4e3406cbd508f0d25236f9e, 4), + ("XAppCaptureTakeScreenshot", 0xa4f1aee24bf14485b008a7c26d52ac27, 0x22e672d7b4e3406cbd508f0d25236f9e, 5), + ("XAppCaptureOpenScreenshotStream", 0xa4f1aee24bf14485b008a7c26d52ac27, 0x22e672d7b4e3406cbd508f0d25236f9e, 6), + ("XAppCaptureReadScreenshotStream", 0xa4f1aee24bf14485b008a7c26d52ac27, 0x22e672d7b4e3406cbd508f0d25236f9e, 7), + ("XAppCaptureCloseScreenshotStream", 0xa4f1aee24bf14485b008a7c26d52ac27, 0x22e672d7b4e3406cbd508f0d25236f9e, 8), + ("XAppCaptureEnableRecord", 0xa4f1aee24bf14485b008a7c26d52ac27, 0x22e672d7b4e3406cbd508f0d25236f9e, 9), + ("XAppCaptureDisableRecord", 0xa4f1aee24bf14485b008a7c26d52ac27, 0x22e672d7b4e3406cbd508f0d25236f9e, 10), + ("XAppCaptureGetVideoCaptureSettings", 0xa4f1aee24bf14485b008a7c26d52ac27, 0x22e672d7b4e3406cbd508f0d25236f9e, 11), + ("XAppCaptureRecordTimespan", 0xa4f1aee24bf14485b008a7c26d52ac27, 0x22e672d7b4e3406cbd508f0d25236f9e, 12), + ("XAppCaptureReadLocalStream", 0xa4f1aee24bf14485b008a7c26d52ac27, 0x22e672d7b4e3406cbd508f0d25236f9e, 13), + ("XAppCaptureCloseLocalStream", 0xa4f1aee24bf14485b008a7c26d52ac27, 0x22e672d7b4e3406cbd508f0d25236f9e, 14), + ("XAppCaptureStartUserRecord", 0xa4f1aee24bf14485b008a7c26d52ac27, 0x22e672d7b4e3406cbd508f0d25236f9e, 15), + ("XAppCaptureStopUserRecord", 0xa4f1aee24bf14485b008a7c26d52ac27, 0x22e672d7b4e3406cbd508f0d25236f9e, 16), + ("XAppCaptureCancelUserRecord", 0xa4f1aee24bf14485b008a7c26d52ac27, 0x22e672d7b4e3406cbd508f0d25236f9e, 17), + ("XPackageGetCurrentProcessPackageIdentifier", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 3), + ("XPackageIsPackagedProcess", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 4), + ("XPackageCreateInstallationMonitor", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 5), + ("XPackageCloseInstallationMonitorHandle", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 6), + ("XPackageGetInstallationProgress", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 7), + ("XPackageUpdateInstallationMonitor", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 8), + ("XPackageRegisterInstallationProgressChanged", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 9), + ("XPackageUnregisterInstallationProgressChanged", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 10), + ("XPackageGetUserLocale", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 11), + ("XPackageFindChunkAvailability", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 12), + ("XPackageEnumerateChunkAvailability", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 13), + ("XPackageChangeChunkInstallOrder", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 14), + ("XPackageInstallChunks", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 15), + ("XPackageInstallChunksAsync", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 16), + ("XPackageInstallChunksResult", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 17), + ("XPackageEstimateDownloadSize", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 18), + ("XPackageUninstallChunks", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 19), + ("XPackageUnregisterPackageInstalled", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 22), + ("XPackageGetMountPathSize", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 24), + ("XPackageGetMountPath", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 25), + ("XPackageCloseMountHandle", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 26), + ("XPackageGetIdentifier", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 27), + ("XPackageGetWriteStats", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 30), + ("XPackageUninstallUWPInstance", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 32), + ("XPackageEnumerateFeatures", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 33), + ("XPackageUninstallPackage", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 34), + ("XPackageMountWithUiAsync", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 37), + ("XPackageMountWithUiResult", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 38), + ("XPackageEnumeratePackages", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 39), + ("XPackageRegisterPackageInstalled", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 40), + ("XPackageGetPackageKind", 0xaf406016e8504aa8a88d2f3dcb9dac7e, 0x0b9d556eab7043f4baa09999ac4cb040, 41), + ("XSystemGetAnalyticsInfo", 0xb884675db7384a9c815d9a9a1e0c6c9b, 0xb884675db7384a9c815d9a9a1e0c6c9b, 3), + ("XGameEventWrite", 0xbbfbdcc7bfe7409ba5caedf054960b4d, 0xbbfbdcc7bfe7409ba5caedf054960b4d, 3), + ("XGameUiShowMessageDialogAsync", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 3), + ("XGameUiShowMessageDialogResult", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 4), + ("XGameUiShowSendGameInviteAsync", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 5), + ("XGameUiShowSendGameInviteResult", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 6), + ("XGameUiShowPlayerProfileCardAsync", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 7), + ("XGameUiShowPlayerProfileCardResult", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 8), + ("XGameUiShowAchievementsAsync", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 9), + ("XGameUiShowAchievementsResult", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 10), + ("XGameUiShowPlayerPickerAsync", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 11), + ("XGameUiShowPlayerPickerResultCount", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 12), + ("XGameUiShowPlayerPickerResult", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 13), + ("XGameUiShowErrorDialogAsync", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 14), + ("XGameUiShowErrorDialogResult", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 15), + ("XGameUiSetNotificationPositionHint", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 16), + ("XGameUiShowTextEntryAsync", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 17), + ("XGameUiShowTextEntryResultSize", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 18), + ("XGameUiShowTextEntryResult", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 19), + ("XGameUiShowWebAuthenticationAsync", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 24), + ("XGameUiShowWebAuthenticationResultSize", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 25), + ("XGameUiShowWebAuthenticationResult", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 26), + ("XGameUiShowWebAuthenticationWithOptionsAsync", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 27), + ("XGameUiShowManageSpaceAsync", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 28), + ("XGameUiShowManageSpaceResult", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 29), + ("XGameUiShowMultiplayerActivityGameInviteAsync", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 30), + ("XGameUiShowMultiplayerActivityGameInviteResult", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 31), + ("XGameUiTextEntryOpen", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 34), + ("XGameUiTextEntryClose", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 35), + ("XGameUiTextEntryGetState", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 36), + ("XGameUiTextEntryGetExtents", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 37), + ("XGameUiTextEntryUpdatePositionHint", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 38), + ("XGameUiTextEntryUpdateVisibility", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 39), + ("XGameUiShowStateShareAsync", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 40), + ("XGameUiShowStateShareResult", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 41), + ("XGameUiSetUiCallbacks", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 42), + ("XGameUiSetMessageDialogUiResponse", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 43), + ("XGameUiSetPlayerPickerUiResponse", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 44), + ("XGameUiSetTextEntryUiResponse", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 45), + ("XGameUiSetPlayerProfileCardUiResponse", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 46), + ("XGameUiSetSendGameInviteUiResponse", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 47), + ("XGameUiSetAchievementsUiResponse", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 48), + ("XGameUiSetMultiplayerActivityGameInviteUiResponse", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 49), + ("XGameUiSetErrorDialogUiResponse", 0xdfcd46494ff84043ba0735d607df98b0, 0xeaf669df5542459099a38dc061f837cc, 50), + ("XSystemGetConsoleId", 0xe349bd1afc204e40b99c4178cc6b409f, 0x1861cf2ee18b4834a9f5b4a4e6efb4cf, 3), + ("XSystemGetXboxLiveSandboxId", 0xe349bd1afc204e40b99c4178cc6b409f, 0x1861cf2ee18b4834a9f5b4a4e6efb4cf, 4), + ("XSystemGetAppSpecificDeviceId", 0xe349bd1afc204e40b99c4178cc6b409f, 0x1861cf2ee18b4834a9f5b4a4e6efb4cf, 5), + ("XSystemHandleTrack", 0xe349bd1afc204e40b99c4178cc6b409f, 0x1861cf2ee18b4834a9f5b4a4e6efb4cf, 6), + ("XSystemIsHandleValid", 0xe349bd1afc204e40b99c4178cc6b409f, 0x1861cf2ee18b4834a9f5b4a4e6efb4cf, 7), + ("XSystemAllowFullDownloadBandwidth", 0xe349bd1afc204e40b99c4178cc6b409f, 0x1861cf2ee18b4834a9f5b4a4e6efb4cf, 8), + ("XPersistentLocalStorageGetPathSize", 0xf4faf4d42d044fceb3e0474a713a3e84, 0x41a4e10c5a7e41d98c3737bde62a07d6, 3), + ("XPersistentLocalStorageGetPath", 0xf4faf4d42d044fceb3e0474a713a3e84, 0x41a4e10c5a7e41d98c3737bde62a07d6, 4), + ("XPersistentLocalStorageGetSpaceInfo", 0xf4faf4d42d044fceb3e0474a713a3e84, 0x41a4e10c5a7e41d98c3737bde62a07d6, 5), + ("XPersistentLocalStoragePromptUserForSpaceAsync", 0xf4faf4d42d044fceb3e0474a713a3e84, 0x41a4e10c5a7e41d98c3737bde62a07d6, 6), + ("XPersistentLocalStoragePromptUserForSpaceResult", 0xf4faf4d42d044fceb3e0474a713a3e84, 0x41a4e10c5a7e41d98c3737bde62a07d6, 7), + ("XPersistentLocalStorageMountForPackage", 0xf4faf4d42d044fceb3e0474a713a3e84, 0x41a4e10c5a7e41d98c3737bde62a07d6, 8), +]; diff --git a/crates/xcl/src/hle/xgameruntime/mod.rs b/crates/xcl/src/hle/xgameruntime/mod.rs index 094eaf5..ad03dec 100644 --- a/crates/xcl/src/hle/xgameruntime/mod.rs +++ b/crates/xcl/src/hle/xgameruntime/mod.rs @@ -5,6 +5,7 @@ pub mod api; pub mod gamesave; +pub mod gdk_table; pub mod taskqueue; pub mod xasync; @@ -218,11 +219,11 @@ fn fixed64(s: &str) -> [u8; 64] { a } +/// What a console reports: the Xbox OS build, family "Windows.Xbox". pub unsafe extern "system" fn XSystemGetAnalyticsInfo() -> XSystemAnalyticsInfo { - let (major, minor, build) = super::kernelx::host_os_version(); - let v = XVersion { major: major as u16, minor: minor as u16, build: build as u16, revision: 0 }; + let v = XVersion { major: 10, minor: 0, build: 25398, revision: 0 }; let form = if crate::state::config().is_series_s() { "Xbox Series S" } else { "Xbox Series X" }; - XSystemAnalyticsInfo { os_version: v, hosting_os_version: v, family: fixed64("Gaming"), form: fixed64(form) } + XSystemAnalyticsInfo { os_version: v, hosting_os_version: v, family: fixed64("Windows.Xbox"), form: fixed64(form) } } // --------------------------------------------------------------------------------------- diff --git a/crates/xcl/tests/gpu_pso_e2e.rs b/crates/xcl/tests/gpu_pso_e2e.rs index 60870bc..49c6ac4 100644 --- a/crates/xcl/tests/gpu_pso_e2e.rs +++ b/crates/xcl/tests/gpu_pso_e2e.rs @@ -68,6 +68,18 @@ fn setup(names: &[&str]) -> Option<(Vec>, ID3D12Device, std::sync::Mutex /// CreateGraphicsPipelineState through the backend hook with the title's own (empty) /// root signature and input layout; asserts the pipeline came from translated shaders. fn pso_through_hook(dev: &ID3D12Device, vs: &[u8], ps: &[u8], layout: &[(&CStr, DXGI_FORMAT, u32)]) -> ID3D12PipelineState { + // a pipeline built in the background behind a stand-in: the real one + real_pso(&pso_through_hook_raw(dev, vs, ps, layout)) +} + +/// The real pipeline of `pso` (waits when it is a stand-in still being built). +fn real_pso(pso: &ID3D12PipelineState) -> ID3D12PipelineState { + let real = xcl::hle::d3d12x::pso_async::resolve_wait(pso.as_raw() as usize) as *mut std::ffi::c_void; + unsafe { ID3D12PipelineState::from_raw_borrowed(&real) }.unwrap().clone() +} + +/// The pipeline the title gets back (a stand-in when its shaders were not compiled yet). +fn pso_through_hook_raw(dev: &ID3D12Device, vs: &[u8], ps: &[u8], layout: &[(&CStr, DXGI_FORMAT, u32)]) -> ID3D12PipelineState { let game_rs: ID3D12RootSignature = unsafe { let desc = D3D12_ROOT_SIGNATURE_DESC { Flags: D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT, ..Default::default() }; let mut ser = None; @@ -202,15 +214,21 @@ fn check_untextured_triangle(dev: &ID3D12Device, pso: &ID3D12PipelineState) { fn retail_pipelines_built_in_the_background_behind_a_stand_in() { use xcl::hle::d3d12x::pso_async; let Some((blobs, dev, _serial)) = setup(&["VS_Rage_TransformPosCpv_f020b20e_Wrapped", "PS_Rage_Untextured_14f8529b_Wrapped"]) else { return }; - let cold = std::env::temp_dir().join(format!("xcl-async-pso-{}", std::process::id())); - let _ = std::fs::remove_dir_all(&cold); - std::env::set_var("XCL_DXIL_CACHE", &cold); - let built_before = pso_async::counts().0; - let pso = pso_through_hook(&dev, &blobs[0], &blobs[1], &UNTEXTURED_LAYOUT); // waits for the real one + /// an empty DXIL cache for this test only (restored also when an assertion fails) + struct ColdCache(std::path::PathBuf); + impl Drop for ColdCache { + fn drop(&mut self) { + std::env::remove_var("XCL_DXIL_CACHE"); + let _ = std::fs::remove_dir_all(&self.0); + } + } + let cold = ColdCache(std::env::temp_dir().join(format!("xcl-async-pso-{}", std::process::id()))); + let _ = std::fs::remove_dir_all(&cold.0); + std::env::set_var("XCL_DXIL_CACHE", &cold.0); + let pso = pso_through_hook_raw(&dev, &blobs[0], &blobs[1], &UNTEXTURED_LAYOUT); // waits for the real one let raw = pso.as_raw() as usize; - assert_eq!(pso_async::counts().0, built_before + 1, "built in the background"); let real = pso_async::resolve(raw); - assert_ne!(real, raw, "the real pipeline replaces the stand-in"); + assert_ne!(real, raw, "a stand-in, replaced by the real pipeline built in the background"); assert!(real::pso_root_signature(raw).is_some(), "the stand-in resolves to the real pipeline's root signature"); let real_pso = unsafe { ID3D12PipelineState::from_raw_borrowed(&(real as *mut std::ffi::c_void)) }.unwrap().clone(); check_untextured_triangle(&dev, &real_pso); @@ -263,13 +281,14 @@ fn retail_pipelines_built_in_the_background_behind_a_stand_in() { let mesh: ID3D12PipelineState = unsafe { d2.CreatePipelineState(&desc) }.expect("mesh stand-in"); let call = t0.elapsed(); let raw = mesh.as_raw() as usize; - assert!(pso_async::is_pending(raw) && real::two_pass_of(raw).is_none(), "a mesh stand-in, no compute pass yet"); drop(st); // the title's description is gone; the worker builds from its own copy assert_ne!(pso_async::resolve_wait(raw), raw); assert!(real::two_pass_of(raw).is_some(), "the two-pass parts through the stand-in"); println!("mesh: the call returned after {call:?}, the real pipeline was ready after {:?}", t0.elapsed()); - std::env::remove_var("XCL_DXIL_CACHE"); - let _ = std::fs::remove_dir_all(&cold); + // the title releases the stand-in: its real pipeline goes with it, the address is forgotten + drop(mesh); + assert_eq!(pso_async::resolve(raw), raw); + assert!(real::two_pass_of(raw).is_none()); } /// Texel (x, y) of the two test textures, RGBA8. @@ -556,7 +575,7 @@ fn retail_mesh_pipelines_through_the_hook() { let t0 = std::time::Instant::now(); let desc = D3D12_PIPELINE_STATE_STREAM_DESC { SizeInBytes: std::mem::size_of::(), pPipelineStateSubobjectStream: &s as *const _ as *mut _ }; match unsafe { d2.CreatePipelineState::(&desc) } { - Ok(p) if real::two_pass_of(p.as_raw() as usize).is_some() => ok += 1, + Ok(p) if real::two_pass_of(real_pso(&p).as_raw() as usize).is_some() => ok += 1, Ok(_) => failed.push(format!("{} + {}: PSO without a compute pass", r.name, pr.name)), Err(e) => { failed.push(format!("{} + {}: {e}", r.name, pr.name)); @@ -599,6 +618,7 @@ fn retail_gs_pipeline_through_the_hook() { d.BlendState.RenderTarget[0].RenderTargetWriteMask = D3D12_COLOR_WRITE_ENABLE_ALL.0 as u8; d.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM; let p: ID3D12PipelineState = unsafe { dev.CreateGraphicsPipelineState(&d) }.unwrap_or_else(|e| panic!("{e}; {:?}", real::stats().translation_errors)); + let p = real_pso(&p); let tp = real::two_pass_of(p.as_raw() as usize).expect("GS pipeline in two passes"); assert_eq!((tp.kind, tp.record.max_vertices), ("GS", 63)); } diff --git a/scripts/gen_gdk_table.py b/scripts/gen_gdk_table.py new file mode 100644 index 0000000..00ef0a5 --- /dev/null +++ b/scripts/gen_gdk_table.py @@ -0,0 +1,24 @@ +"""Generate crates/xcl/src/hle/xgameruntime/gdk_table.rs from a table of the GDK runtime's +functions: every function with the class, interface and vtable slot its thunk uses +(QueryApiImpl protocol), as extracted from the public PC GDK's xgameruntime.lib. Input lines: +`NAME(function, "class guid", "interface guid", slot)`. + +usage: python scripts/gen_gdk_table.py """ +import io, os, re, sys + +src = io.open(sys.argv[1], encoding='utf-8').read() +origin = re.search(r'Source\s*:\s*(\S+)', src) +rows = re.findall(r'\w+\((\w+), "([0-9A-Fa-f-]{36})", "([0-9A-Fa-f-]{36})", (\d+)\)', src) +assert rows, 'no rows' +hexg = lambda g: '0x' + g.replace('-', '').lower() +OUT = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'crates', 'xcl', 'src', 'hle', 'xgameruntime', 'gdk_table.rs') +with io.open(OUT, 'w', encoding='utf-8', newline='\n') as f: + f.write('//! Generated by scripts/gen_gdk_table.py – do not edit.\n') + f.write(f'//! The GDK runtime\'s functions as the public PC GDK\'s xgameruntime.lib ({origin.group(1) if origin else "?"}) calls them:\n') + f.write('//! the (class, interface) its thunk asks QueryApiImpl for and the vtable slot it calls.\n\n') + f.write('/// (function, class id, interface id, slot)\n') + f.write('pub static API: &[(&str, u128, u128, u8)] = &[\n') + for name, c, i, slot in sorted(rows, key=lambda r: (r[1], r[2], int(r[3]))): + f.write(f' ("{name}", {hexg(c)}, {hexg(i)}, {slot}),\n') + f.write('];\n') +print(len(rows), 'rows ->', os.path.normpath(OUT))