Repository navigation
xgameruntime: serve XUserImpl (offline local user) through QueryApiImpl - #3363
Conversation
A GDK title links the XUser* functions statically (xgameruntime.lib); each thunk asks QueryApiImpl for XUserImpl and calls one slot with the function's arguments after `this` (docs/runtime_imports.md). QueryApiImpl refused the class, so XUserAddAsync, the call a title makes at boot before nearly anything else, could not succeed. runtime/shims/xgameruntime_user.cpp serves it, in its own file so the other class PRs touching xgameruntime.cpp only meet it at one line: - ids and slot order from xgameruntime-docs (facts only), signatures, enum values and E_GAMEUSER_* codes from the public GDK reference; - IXUserImpl..IXUserImpl6 answer with one 50-slot vtable, IXUserGamertagImpl (XUserGetGamertag) with a second; - one offline user, always signed in: XUserAddAsync (silent or not; AllowGuests with AddDefaultUserSilently is E_INVALIDARG), fixed ids, FindUserById/ByLocalId, Duplicate/Close/Compare, not a guest, adult, every privilege, ResolvePrivilegeWithUi, AddByIdWithUi, IsStoreUser, change-event tokens; gamertag from LEONIDA_GAMERTAG, "Player" otherwise; - tokens, gamer picture, MSA tokens and resolve-issue fail synchronously before starting; no sign-out deferral; private and PC-only slots log once. xgameruntime_user_test (40 checks) drives every served slot; a second ctest run checks LEONIDA_GAMERTAG. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cb23022 to
056661d
Compare
|
Code review of 056661d (AI-assisted), with a synthetic probe executable in a private copy, built with MSVC / Ninja on Windows 11 23H2. Nothing was pushed.
Smaller:
Checked and found correct:
|
…ndles) From @CharlyRien's review of 056661d: - XUserUnregisterForChangeEvent returns true for every token: false means "still pending", which never happens offline, so a title polling with wait = false spun on an unknown or repeated token. - XUserIsStoreUser is true, also for a null handle (_In_opt_; documented as always true on console). - Slot 15 (no public signature) answers E_NOTIMPL instead of S_OK with nothing written. XUserIsSignOutPresent (47) stays 0: it is read as a bool, and E_NOTIMPL's low byte would mean true. - Handles are validated by lookup in a live set rather than by reading a magic in memory that may already be freed; a double close is a no-op. - LEONIDA_GAMERTAG of any length reaches the "longer than 15" message (the length is queried first; 64+ characters fell back silently). Tests: 42 checks; a new ctest run with a 70-character gamertag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@CharlyRien, thanks for the careful review and the MSVC run. All five points are fixed in b6213c9:
42 checks; the four |
… slots The same fixes @CharlyRien's review of ItsNotRexed#3363 led to for XUserImpl: - context, license and product-query handles are looked up by kind in a live map, never read, so a closed, foreign or wrong-kind pointer is refused without touching freed memory, and a double close is a no-op; - the docs' unknown slots 46-48 answer E_NOTIMPL instead of S_OK with nothing written; XStoreIsAvailabilityPurchasable (70) stays 0, since it is read as a bool and E_NOTIMPL's low byte would mean true. Tests: 33 checks (double close, slot 46, slot 70). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Windows + GPU check: AMD Radeon RX 9070 (RDNA4), Windows 11, MSVC Release, Vulkan SDK 1.4.363. Tested head b6213c9 merged onto Coordination note: my XGameSaveImpl PR #3505 also goes in its own file and touches AI-assisted (Claude Code); runs on my machine. |
|
Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head merged with main f847748, MSVC 14.51):
Only these three tests were built and run, not the full ctest. No concerns. |
|
Layout note (read only): I compared your 50-slot XUserImpl vtable with the LGPL Wine IDL ( AI-assisted review (Claude Code). |
Item: new RT item, claimed in #3232 (claim).
Why
A GDK title links
XUserAddAsync,XUserGetId,XUserGetGamertagand the rest statically (xgameruntime.lib). Each thunk asksQueryApiImplforXUserImpland calls one slot with the function's own arguments afterthis. That mechanism is measured on the package's own DLLs (docs/runtime_imports.md, "Run-time loaded modules").QueryApiImplrefusedXUserImpl, soXUserAddAsync, one of the first calls a title makes, could only fail.What
runtime/shims/xgameruntime_user.cpp, in its own file, so the other class PRs (#2203, #2218) only meet it at one line ofQueryApiImpl.main's other classes). Signatures, enum values andE_GAMEUSER_*codes come from Microsoft's public GDK reference (the XUser pages and the error-code table). No GDK header or code is used.IXUserImpl's;IXUserImpl2–6answer with the same 50-slot vtable;IXUserGamertagImpl(XUserGetGamertag) is a second interface of the object.XUserAddAsync/XUserAddResult, silent or not.AllowGueststogether withAddDefaultUserSilentlyisE_INVALIDARG, as documented.XUserAddByIdWithUiAsync: the local id adds the user; any other id isE_GAMEUSER_USER_NOT_FOUND.XUserFindUserById/ByLocalIdfinding them and anything else beingE_GAMEUSER_USER_NOT_FOUND.SignedIn,Adult, and every privilege (XUserCheckPrivilege);XUserResolvePrivilegeWithUiAsynccompletes with S_OK;XUserIsStoreUseris true;XUserGetMaxUsersis 1.LEONIDA_GAMERTAG(15 printable ASCII characters at most),Playerotherwise. Classic, Modern and UniqueModern give the same text, ModernSuffix is empty, andgamertagUsedcounts the terminator.XUserCloseHandle;XUserCompareis 0 for any two, since they all name the one user.XAsyncBlockis left waiting.XUserGetSignOutDeferralisE_GAMEUSER_DEFERRAL_NOT_AVAILABLE.IXUserImpl5slots, andIXUserImpl6's undocumented sign-out trio.Not measured yet: no package DLL calls an
XUser*slot (libHttpClient.GDK.dllonly holds the GUID table, up toIXUserImpl5), so the slot order rests on xgameruntime-docs until the executable's first boot. The order matched on every slot measured forXThreadingImpl,XErrorImplandXNetworkingImpl.docs/runtime_imports.mdsays so.Tests
xgameruntime_user_test(40 checks) gets the class throughrt::shims::find("xgameruntime.dll", "QueryApiImpl"), as a thunk would, and calls each served slot with the documented arguments. It covers:A second ctest run sets
LEONIDA_GAMERTAG=Tester42and checks it; a gamertag that is too long falls back toPlayerwith a message.Tested
Fedora 44, clang-cl 22.1.8 with xwin (SDK 10.0.26100),
/W4: no warnings in the new files.xgameruntime,xgameruntime_userandxgameruntime_user_gamertagpass.main(fsr_dispatchandbvh_builderare the clang 22.1.8 crash;device_proxyandd3d12_presentcompare against Wine's D3D12).scripts/build_runtime.ps1's source list includes the new file. Not run: MSVC, native Windows.XGameSaveImplis the natural next class; it's waiting for @IAmNotSiob's answer on #279.No game files. AI-assisted (Claude Code).
🤖 Generated with Claude Code