xgameruntime: XUserFindForDevice answers E_GAMEUSER_USER_NOT_FOUND until XUserAddAsync (RT-382) #126

Closed
leonida/mandy
Andretuta wants to merge 0 commits from old-pr/9860 into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

Andretuta commented 2026-11-24 02:23:57 +00:00

Carried over from old PR 9860 by milas6669 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9860, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
milas6669: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Resubmission of #5166 (closed during repo transfer/purge at 22:47 UTC). Mergeable with current main with zero conflicts.

Claimed in the coordination issue as: RT-382, https://github.com/ItsNotRexed/Leonida/issues/5156#issuecomment-7095909064 (found by @Roberto0953)

What and why

XUserFindForDevice (XUserDeviceImpl slot 3, device_find_user in runtime/shims/xgameruntime_offline.cpp) handed out an XUserHandle before the title had called XUserAddAsync. The GDK reference says it "cannot return a user handle to a user that hasn't been signed in with a call to XUserAddAsync". A title that probes its devices before signing in saw a user it never added, which can change its first-boot sign-in flow.

  • xgameruntime_user.cpp: an atomic flag, set when XUserAddAsync completes (and when the local user is added by id), exposed to the other shim as xgameruntime_user_was_added().
  • device_find_user: before the flag is set it writes no handle and answers E_GAMEUSER_USER_NOT_FOUND (0x89245104, the code the user shim already uses); after it, the handle as before.
  • docs/runtime_imports.md: the "Devices" paragraph states the rule.

Tested

Windows 11, MSVC 19.44 + Ninja, RelWithDebInfo.

  • xgameruntime_offline_test: passes 32/32 checks (fails 4 of 32 on merge base).
  • ctest -R xgameruntime: 8/8 passed.
  • Independently verified by @shdann, @gertify, @Atomic258, @searyecheesepeaceful on #5166.

Synthetic probes only; no game data.

AI-assisted: yes

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md).
> Carried over from **old PR 9860** by `milas6669` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9860`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `milas6669`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Resubmission of `#5166` (closed during repo transfer/purge at 22:47 UTC). Mergeable with current main with zero conflicts. Claimed in the coordination issue as: RT-382, https://github.com/ItsNotRexed/Leonida/issues/5156#issuecomment-7095909064 (found by `@Roberto0953`) ### What and why `XUserFindForDevice` (XUserDeviceImpl slot 3, `device_find_user` in `runtime/shims/xgameruntime_offline.cpp`) handed out an `XUserHandle` before the title had called `XUserAddAsync`. The GDK reference says it "cannot return a user handle to a user that hasn't been signed in with a call to XUserAddAsync". A title that probes its devices before signing in saw a user it never added, which can change its first-boot sign-in flow. - `xgameruntime_user.cpp`: an atomic flag, set when `XUserAddAsync` completes (and when the local user is added by id), exposed to the other shim as `xgameruntime_user_was_added()`. - `device_find_user`: before the flag is set it writes no handle and answers `E_GAMEUSER_USER_NOT_FOUND` (`0x89245104`, the code the user shim already uses); after it, the handle as before. - `docs/runtime_imports.md`: the "Devices" paragraph states the rule. ### Tested Windows 11, MSVC 19.44 + Ninja, RelWithDebInfo. - `xgameruntime_offline_test`: passes 32/32 checks (fails 4 of 32 on merge base). - `ctest -R xgameruntime`: 8/8 passed. - Independently verified by `@shdann`, `@gertify`, `@Atomic258`, `@searyecheesepeaceful` on `#5166`. Synthetic probes only; no game data. AI-assisted: yes ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md).
fiestorra commented 2026-11-30 09:49:29 +00:00

Independent verification on this machine (Windows 11, MSVC 19.44.35226), with a negative control that bites on both tests.

1. It applies. merge-tree clean; the commits cherry-pick onto main 4014af7fe without a conflict. Four files, two of them shims: runtime/shims/xgameruntime_offline.cpp and runtime/shims/xgameruntime_user.cpp.

2. With the branch, both tests pass:

ctest -R '^xgameruntime_offline'
100% tests passed, 0 tests failed out of 2

3. The control - revert both shims, keep the test:

git checkout origin/main -- runtime/shims/xgameruntime_user.cpp runtime/shims/xgameruntime_offline.cpp
cmake --build … --target xgameruntime_offline_test
ctest -R '^xgameruntime_offline' --output-on-failure
0% tests passed, 2 tests failed out of 2
FAIL XUserFindForDevice before XUserAddAsync: E_GAMEUSER_USER_NOT_FOUND and no handle

That assertion is the change: before this branch, the offline shim answered a per-client query for a user that had not signed in yet, instead of failing with E_GAMEUSER_USER_NOT_FOUND and writing no handle. The test names the exact behaviour the diff adds, which is the cleanest kind of control - the failure message is a sentence about the change, not a generic mismatch.

What the change is, from the diff and the doc it updates: XUserFindForDevice (and the by-id path) now answer E_GAMEUSER_USER_NOT_FOUND and write no handle until XUserAddAsync has completed, quoting the SDK's own rule that a user handle cannot be returned for a user not signed in with XUserAddAsync.

What I did not test: the rest of the offline surface, and the docs/runtime_imports.md half of the change (documentation, no executable path).

Why I am commenting: I verify open pull requests that replay onto current main by applying them in a scratch worktree, building the targets their tests name in ctest --show-only=json-v1, running them, and then reverting only the source change to see whether the tests still pass. This is the fifth control on the shortlist of 122: #156 and #537 bite, #126 bites on both tests, #183's control is compile-level only, and #138's did not bite on half of its change.

Written with an AI assistant.

Independent verification on this machine (Windows 11, MSVC 19.44.35226), with a negative control that bites on both tests. **1. It applies.** `merge-tree` clean; the commits cherry-pick onto `main` `4014af7fe` without a conflict. Four files, two of them shims: `runtime/shims/xgameruntime_offline.cpp` and `runtime/shims/xgameruntime_user.cpp`. **2. With the branch, both tests pass:** ``` ctest -R '^xgameruntime_offline' 100% tests passed, 0 tests failed out of 2 ``` **3. The control - revert both shims, keep the test:** ``` git checkout origin/main -- runtime/shims/xgameruntime_user.cpp runtime/shims/xgameruntime_offline.cpp cmake --build … --target xgameruntime_offline_test ctest -R '^xgameruntime_offline' --output-on-failure 0% tests passed, 2 tests failed out of 2 FAIL XUserFindForDevice before XUserAddAsync: E_GAMEUSER_USER_NOT_FOUND and no handle ``` **That assertion is the change**: before this branch, the offline shim answered a per-client query for a user that had not signed in yet, instead of failing with `E_GAMEUSER_USER_NOT_FOUND` and writing no handle. **The test names the exact behaviour the diff adds**, which is the cleanest kind of control - the failure message is a sentence about the change, not a generic mismatch. **What the change is, from the diff and the doc it updates:** `XUserFindForDevice` (and the by-id path) now answer `E_GAMEUSER_USER_NOT_FOUND` and write no handle until `XUserAddAsync` has completed, quoting the SDK's own rule that a user handle cannot be returned for a user not signed in with `XUserAddAsync`. **What I did not test:** the rest of the offline surface, and the `docs/runtime_imports.md` half of the change (documentation, no executable path). **Why I am commenting:** I verify open pull requests that replay onto current `main` by applying them in a scratch worktree, building the targets their tests name in `ctest --show-only=json-v1`, running them, and then reverting **only** the source change to see whether the tests still pass. **This is the fifth control on the shortlist of 122**: #156 and #537 bite, #126 bites on both tests, #183's control is compile-level only, and **#138's did not bite on half of its change**. Written with an AI assistant.
MoonEyes commented 2026-11-30 19:01:15 +00:00

The change is still relevant: current main unconditionally hands out an offline user in device_find_user, and its test still expects that before XUserAddAsync. The independent Windows recheck reports both targeted tests pass and its negative control fails as expected. I am leaving this open, not merge-ready: the branch commit records conflicts in docs/runtime_imports.md and runtime/test/xgameruntime_offline_test.cpp, it is still a draft, and the available CI checks were cancelled. Please rebase onto current main and rerun the required CI/Windows runtime checks; keep the HRESULT assumption explicit as documented.

The change is still relevant: current `main` unconditionally hands out an offline user in `device_find_user`, and its test still expects that before `XUserAddAsync`. The independent Windows recheck reports both targeted tests pass and its negative control fails as expected. I am leaving this open, not merge-ready: the branch commit records conflicts in `docs/runtime_imports.md` and `runtime/test/xgameruntime_offline_test.cpp`, it is still a draft, and the available CI checks were cancelled. Please rebase onto current `main` and rerun the required CI/Windows runtime checks; keep the HRESULT assumption explicit as documented.
aslan2142 commented 2026-12-01 12:09:31 +00:00

Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.

(AI-assisted triage.)

Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review. *(AI-assisted triage.)*
aslan2142 commented 2026-12-01 16:22:25 +00:00

Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.
Sign in to join this conversation.
No description provided.