feat(userservice): implement foreground user, registered list, user colour and NP account id #553

Merged
Phi1ow merged 2 commits from upstream-pr/553 into main 2026-10-06 22:41:16 +00:00
Phi1ow commented 2026-10-04 19:49:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Phi1ow on 2026-10-04T19:49:32Z.


What

Four libSceUserService exports that titles call during start-up were missing. They now
return correct, general values for the single-user / offline model this library already
implements (sceUserServiceGetInitialUser, sceUserServiceGetLoginUserIdList,
sceUserServiceGetPlatformPrivacyWs1): validate the pointer and the user id, write the
value, return USER_SERVICE_OK.

  • sceUserServiceGetForegroundUser(int* userId) — the only logged-in user is always in the
    foreground, so it returns USER_SERVICE_INITIAL_USER_ID, like sceUserServiceGetInitialUser.
  • sceUserServiceGetRegisteredUserIdList(UserServiceRegisteredUserIdList* list) — the initial
    user occupies slot 0 and the remaining 15 slots are USER_SERVICE_USER_ID_INVALID, the
    16-entry counterpart of the existing 4-entry sceUserServiceGetLoginUserIdList.
  • sceUserServiceGetUserColor(int userId, int* color) — a fresh profile defaults to blue
    (0); other user ids give USER_SERVICE_ERROR_INVALID_ARGUMENT.
  • sceUserServiceGetNpAccountId(int userId, uint64_t* accountId) — no PSN account is linked,
    so the account id is 0, consistent with sceUserServiceGetPlatformPrivacyWs1.

Adds UserServiceRegisteredUserIdList { int user_id[16]; } to SceTypes.hpp (next to the
existing UserServiceLoginUserIdList) and a CMakeLists.txt for the library so it can carry
a guest test.

Signatures and the user-colour enum follow the public OpenOrbis SDK headers
(include/orbis/UserService.h, include/orbis/_types/user.h).

Tested

New test core/libs/tests/GuestUserService.cpp (registered as guest_user_service): it
checks the valid returns, the null-pointer error, and the wrong-user-id error for each of the
four functions. It fails without the change (the four symbols are undefined) and passes with
it.

Built with MinGW-w64 GCC 15.2.0 (the CI toolchain) on Windows 11; ctest -R guest_user_service passes. Without the four implementations the test does not link (the symbols are undefined).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4737127729 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/553). Originally posted by [Phi1ow](https://github.com/Phi1ow) on 2026-10-04T19:49:32Z. --- ### What Four `libSceUserService` exports that titles call during start-up were missing. They now return correct, general values for the single-user / offline model this library already implements (`sceUserServiceGetInitialUser`, `sceUserServiceGetLoginUserIdList`, `sceUserServiceGetPlatformPrivacyWs1`): validate the pointer and the user id, write the value, return `USER_SERVICE_OK`. - `sceUserServiceGetForegroundUser(int* userId)` — the only logged-in user is always in the foreground, so it returns `USER_SERVICE_INITIAL_USER_ID`, like `sceUserServiceGetInitialUser`. - `sceUserServiceGetRegisteredUserIdList(UserServiceRegisteredUserIdList* list)` — the initial user occupies slot 0 and the remaining 15 slots are `USER_SERVICE_USER_ID_INVALID`, the 16-entry counterpart of the existing 4-entry `sceUserServiceGetLoginUserIdList`. - `sceUserServiceGetUserColor(int userId, int* color)` — a fresh profile defaults to blue (`0`); other user ids give `USER_SERVICE_ERROR_INVALID_ARGUMENT`. - `sceUserServiceGetNpAccountId(int userId, uint64_t* accountId)` — no PSN account is linked, so the account id is `0`, consistent with `sceUserServiceGetPlatformPrivacyWs1`. Adds `UserServiceRegisteredUserIdList { int user_id[16]; }` to `SceTypes.hpp` (next to the existing `UserServiceLoginUserIdList`) and a `CMakeLists.txt` for the library so it can carry a guest test. Signatures and the user-colour enum follow the public OpenOrbis SDK headers (`include/orbis/UserService.h`, `include/orbis/_types/user.h`). ### Tested New test `core/libs/tests/GuestUserService.cpp` (registered as `guest_user_service`): it checks the valid returns, the null-pointer error, and the wrong-user-id error for each of the four functions. It fails without the change (the four symbols are undefined) and passes with it. Built with MinGW-w64 GCC 15.2.0 (the CI toolchain) on Windows 11; `ctest -R guest_user_service` passes. Without the four implementations the test does not link (the symbols are undefined). ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
oneandonlydean commented 2026-10-04 21:19:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T21:19:37Z.


Thanks. The names match their NIDs, the foreground user and the 16-entry registered list follow the existing sceUserServiceGetInitialUser / sceUserServiceGetLoginUserIdList, and colour 0 is SCE_USER_SERVICE_USER_COLOR_BLUE in the OpenOrbis header.

One thing about sceUserServiceGetNpAccountId: it reports success with account id 0, but main's sceNpGetAccountIdA (libSceNpManager/Export.cpp) answers the same question with SCE_NP_ERROR_SIGNED_OUT. A title that reads the account id through UserService would then think the user has a PSN account with id 0. Do you know what the real function returns for a user with no linked account? If not, I'd either make it throw until that's known, or keep 0 and add a line under "Unknown function info" in docs/dev/TechnicalDebt.md saying the result is assumed. The same goes for the default colour, since it's also an assumption.

The CI run on this PR still needs approval; I'll check it once it has run.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5984497427 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/553#issuecomment-5984497427). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-04T21:19:37Z. --- Thanks. The names match their NIDs, the foreground user and the 16-entry registered list follow the existing `sceUserServiceGetInitialUser` / `sceUserServiceGetLoginUserIdList`, and colour 0 is `SCE_USER_SERVICE_USER_COLOR_BLUE` in the OpenOrbis header. One thing about `sceUserServiceGetNpAccountId`: it reports success with account id 0, but main's `sceNpGetAccountIdA` (libSceNpManager/Export.cpp) answers the same question with `SCE_NP_ERROR_SIGNED_OUT`. A title that reads the account id through UserService would then think the user has a PSN account with id 0. Do you know what the real function returns for a user with no linked account? If not, I'd either make it throw until that's known, or keep 0 and add a line under "Unknown function info" in docs/dev/TechnicalDebt.md saying the result is assumed. The same goes for the default colour, since it's also an assumption. The CI run on this PR still needs approval; I'll check it once it has run.
github-actions[bot] commented 2026-10-04 22:33:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-04T22:33:06Z.


Progress report (5fc8755 → f467f51)

📈 System libraries: 87.1% (+0.02%, +4 implemented functions)

✅ 4 implemented
Library Name
libSceUserService sceUserServiceGetForegroundUser
libSceUserService sceUserServiceGetNpAccountId
libSceUserService sceUserServiceGetRegisteredUserIdList
libSceUserService sceUserServiceGetUserColor
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5985181452 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/553#issuecomment-5985181452). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-04T22:33:06Z. --- <!-- progress-report --> ### Progress report (5fc8755 → f467f51) 📈 **System libraries**: 87.1% (+0.02%, +4 implemented functions) <details> <summary>✅ 4 implemented</summary> | Library | Name | | - | - | | libSceUserService | `sceUserServiceGetForegroundUser` | | libSceUserService | `sceUserServiceGetNpAccountId` | | libSceUserService | `sceUserServiceGetRegisteredUserIdList` | | libSceUserService | `sceUserServiceGetUserColor` | </details>
Phi1ow commented 2026-10-04 22:34:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Phi1ow on 2026-10-04T22:34:21Z.


Thanks for the review. I kept the values and documented both as assumptions under "Unknown function info" in docs/dev/TechnicalDebt.md (NP account id 0 vs SCE_NP_ERROR_SIGNED_OUT, and the blue default colour). I don't have a confirmed source for either, so I'm happy to switch sceUserServiceGetNpAccountId to throw instead if you'd prefer that until it's known.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5985191239 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/553#issuecomment-5985191239). Originally posted by [Phi1ow](https://github.com/Phi1ow) on 2026-10-04T22:34:21Z. --- Thanks for the review. I kept the values and documented both as assumptions under "Unknown function info" in docs/dev/TechnicalDebt.md (NP account id 0 vs `SCE_NP_ERROR_SIGNED_OUT`, and the blue default colour). I don't have a confirmed source for either, so I'm happy to switch `sceUserServiceGetNpAccountId` to throw instead if you'd prefer that until it's known.
oneandonlydean commented 2026-10-04 23:43:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T23:43:50Z.


Thanks, documenting both assumptions works for me; with the TechnicalDebt lines a title that depends on the account id will be easy to trace back here. guest_user_service passes here and CI is green. Ready to merge from my side.

This, #516 and #518 all insert at the same place in TechnicalDebt.md, so whichever lands later needs a one-line rebase.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5985701419 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/553#issuecomment-5985701419). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-04T23:43:50Z. --- Thanks, documenting both assumptions works for me; with the TechnicalDebt lines a title that depends on the account id will be easy to trace back here. `guest_user_service` passes here and CI is green. Ready to merge from my side. This, #516 and #518 all insert at the same place in TechnicalDebt.md, so whichever lands later needs a one-line rebase.
oneandonlydean commented 2026-10-05 01:18:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T01:18:16Z.


#516 and #579 are on main now, so this needs a small rebase in docs/dev/TechnicalDebt.md. #579 replaced the "AMPR WaitOnAddress / WaitOnCounter ... WAIT_REG_MEM" line, so the resolution is main's lines (the sceRtcParseDateTime and the two AMPR lines) plus your two libSceUserService lines, without the old WAIT_REG_MEM one. Nothing else conflicts. Ready to merge from my side after that.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5986480458 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/553#issuecomment-5986480458). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-05T01:18:16Z. --- #516 and #579 are on main now, so this needs a small rebase in docs/dev/TechnicalDebt.md. #579 replaced the "AMPR WaitOnAddress / WaitOnCounter ... WAIT_REG_MEM" line, so the resolution is main's lines (the sceRtcParseDateTime and the two AMPR lines) plus your two libSceUserService lines, without the old WAIT_REG_MEM one. Nothing else conflicts. Ready to merge from my side after that.
oneandonlydean commented 2026-10-06 21:20:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T21:20:51Z.


Are you still working on this? It still needs the one-line docs/dev/TechnicalDebt.md rebase from 10-05; the code was ready from my side then. If you'd rather not continue, please say so, and it can be closed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6025674798 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/553#issuecomment-6025674798). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-06T21:20:51Z. --- Are you still working on this? It still needs the one-line `docs/dev/TechnicalDebt.md` rebase from 10-05; the code was ready from my side then. If you'd rather not continue, please say so, and it can be closed.
Phi1ow commented 2026-10-06 21:52:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Phi1ow on 2026-10-06T21:52:15Z.


Rebased. docs/dev/TechnicalDebt.md now keeps main's lines (sceRtcParseDateTime and the two AMPR lines) plus the two libSceUserService lines, without the old WAIT_REG_MEM one. guest_user_service passes here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6026125742 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/553#issuecomment-6026125742). Originally posted by [Phi1ow](https://github.com/Phi1ow) on 2026-10-06T21:52:15Z. --- Rebased. docs/dev/TechnicalDebt.md now keeps main's lines (sceRtcParseDateTime and the two AMPR lines) plus the two libSceUserService lines, without the old WAIT_REG_MEM one. guest_user_service passes here.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!553
No description provided.