Commit Graph

2 Commits

Author SHA1 Message Date
b6213c91dc xgameruntime_user: review fixes (unregister, IsStoreUser, slot 15, handles)
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>
2026-11-22 21:59:07 +01:00
056661d125 xgameruntime: serve XUserImpl (offline local user) through QueryApiImpl
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>
2026-11-22 21:21:21 +01:00