user_service: bind sceUserServiceTerminate to its own NID and implement sceUserServiceGetForegroundUser #2498
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!2498
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2498/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@DIMPM32145 on GitHub · 2026-11-21 16:40 UTC · original
DIMPM32145:user-service-foreground-terminate→main· +139 −9 · 3 files · 3 commits · merged 2026-11-22 12:14 UTCSummary
bwFjS+bX9mA(sceUserServiceTerminate) was mistakenly registered toUserServiceGetUserNumber. When titles clean up or reset user services, callingsceUserServiceTerminate()invoked a 2-argument getter with uninitialized register state. It is now bound toUserServiceTerminate().sceUserServiceGetForegroundUser(eNb53LQJmIM), querying the active foreground controller/user (Config::GetUserId()), withnullptrvalidation returningUSER_SERVICE_ERROR_INVALID_ARGUMENT.sceUserServiceGetRegisteredUserIdList(5EiQCnL2G1Y).tests/UserServiceTests.cppunit test suite covering initialization, foreground user lookup, registered/logged-in user list retrieval, user number queries, and clean termination.Affected Games
Titles querying foreground user state during controller session setup and calling user service termination on shutdown/mode transitions (e.g. Astro's Playroom, Neptunia ReVerse, and UE4/UE5 games).
Testing
Built with
clang-cland Ninja; all tests inuser_service_testspass:@coderabbitai[bot] on GitHub · 2026-11-21 16:44 UTC · original · edited 2026-11-21 18:38 UTC
No actionable comments were generated in the recent review.
Walkthrough
The change adds UserService termination, foreground-user lookup, and registered-user-list functions. It updates symbol registration for these functions and the user-number function. It also adds a Google Test executable with coverage for UserService initialization, lookups, and error cases, and registers that executable with CMake and CTest.
Suggested reviewers:
nmzikChange: Bug fix
Merge Risk:
Minimal · up to
a73d6This change fixes the termination mapping and adds foreground-user and registered-user-list lookups. The registered list is now fully initialized, so games no longer read stale values. The tests cover the new behavior and are wired into the build. Remaining uncertainty is limited to whether guest slots should appear in the registered list, which is minor and not established as a defect.
Pre-merge checks:
4
Full details: Title check
Explanation
The title names the two main changes: the sceUserServiceTerminate NID rebinding to UserServiceTerminate, and the new sceUserServiceGetForegroundUser implementation. The summary and objectives both describe these changes. The title is slightly long at 103 characters, but it is specific and accurate.
Full details: Description check
Explanation
The description states the NID mapping fix, the foreground-user implementation with nullptr validation, the registered user ID list implementation, the new unit test suite, affected titles, and the test run output. It matches the changeset and objectives.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
a2b53d1d-4fac-4ff3-adf9-ed10272164bbReviewing files that changed from the base of the PR and between
c53ed85166anda73d62b4fd.src/libs/libUserService.cpptests/UserServiceTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
@coderabbitai[bot] on GitHub · 2026-11-21 16:44 UTC · original
On
src/libs/libUserService.cppline 131 (outdated):Use the registered-user list layout and initialize every slot.
sceUserServiceGetRegisteredUserIdListtakes a registered-user list with 16 entries, not the four-entry login-user list used here. The public headers declare these as separate types. (raw.githubusercontent.com)With
MAX_PLAYERS == 4, the first loop writes four IDs. The trailing loop never runs. A guest that scans all 16 entries therefore reads unchanged values as additional user IDs.Define a separate registered-user list type. Keep the four configured IDs and fill entries 4 through 15 with
-1. Update the registered-list test to check the complete output.@coderabbitai[bot] on GitHub · 2026-11-21 16:44 UTC · original · reviewed
Actionable comments posted: 1
806ba646-27bd-4b01-9ee5-a14858632e47Reviewing files that changed from the base of the PR and between
39936ffa39andc53ed85166.CMakeLists.txtsrc/libs/libUserService.cpptests/UserServiceTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.