Skip to content

feat(libSceUserService): implement sceUserServiceGetUserStatus and account mapping - #4433

Closed
ErenYeager1836 wants to merge 3 commits into
boykopovar:mainfrom
ErenYeager1836:feat/userservice-status-and-account-id
Closed

ErenYeager1836 wants to merge 3 commits into
boykopovar:mainfrom
ErenYeager1836:feat/userservice-status-and-account-id

Conversation

@ErenYeager1836

@ErenYeager1836 ErenYeager1836 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What

Implement sceUserServiceGetUserStatus, sceUserServiceGetUserIdByNpAccountId, and sceUserServiceGetUserIdByUserName in libSceUserService:

  • sceUserServiceGetUserStatus reports USER_SERVICE_USER_STATUS_LOGGED_IN (1) for USER_SERVICE_INITIAL_USER_ID and USER_SERVICE_ERROR_NOT_LOGGED_IN for absent users, matching the sibling getters' argument precedence.
  • sceUserServiceGetUserIdByNpAccountId maps the initial account id (0) to USER_SERVICE_INITIAL_USER_ID, returning USER_SERVICE_ERROR_UNKNOWN_USER for non-zero account IDs.
  • sceUserServiceGetUserIdByUserName resolves the default profile username ("Player") to USER_SERVICE_INITIAL_USER_ID, rejecting unknown usernames with USER_SERVICE_ERROR_UNKNOWN_USER.
  • Add test coverage in GuestUserService.cpp validating all success and error return paths with sentinels and 64-bit boundaries.
  • Link libc into guest_user_service_tests in CMakeLists.txt for std::strcmp username assertions.
  • Document single-user state and identifier mappings in TechnicalDebt.md.

Tested

Windows 11, MinGW-w64 GCC 15.2.0, ctest guest_user_service passed in 0.08 s (exercising status, 64-bit account bounds, and exact string matches).

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
  • Unblocks: none
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Progress report (2f4cc89 → fa40c39)

📈 System libraries: 86.38% (+0.02%, +3 implemented functions)

✅ 3 implemented
Library Name
libSceUserService sceUserServiceGetUserIdByNpAccountId
libSceUserService sceUserServiceGetUserIdByUserName
libSceUserService sceUserServiceGetUserStatus

int APS5_VABI sceUserServiceGetUserColor(int user_id, int* color);
int APS5_VABI sceUserServiceGetNpAccountId(int user_id, std::uint64_t* account_id);
int APS5_VABI sceUserServiceGetAgeLevel(int user_id, std::uint32_t* age_level);
int APS5_VABI sceUserServiceGetUserStatus(int user_id, std::int32_t* status);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These declarations are not called from main(), so guest_user_service does not exercise the three new implementations, despite the PR description saying it covers their success and error paths. Could you add assertions for the initial/unknown user and account/name cases, plus null output pointers, before relying on this test pass?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thorough review @MarcZX100!

Pushed commit 7e779f0e1 adding the test assertions right after GetAgeLevel:

  • Reuses 0x5a5a5a5a sentinels to verify error paths leave output buffers untouched.
  • Tested sceUserServiceGetUserStatus: checks initial user success (USER_STATUS_LOGGED_IN), absent users returning NOT_LOGGED_IN (even with null pointers, matching GetAgeLevel), and null pointer on initial user returning INVALID_ARGUMENT.
  • Tested sceUserServiceGetUserIdByNpAccountId: checks initial account (0), null pointer paths, and unknown accounts including 0x100000000ull to guard against 32-bit truncation.
  • Tested sceUserServiceGetUserIdByUserName: checks exact match ("Player"), null pointers, and mismatch strings ("", "Playe", "Player2").

…count mapping

- Export sceUserServiceGetUserStatus, reporting logged-in status (1) for USER_SERVICE_INITIAL_USER_ID and USER_SERVICE_ERROR_NOT_LOGGED_IN for absent users.
- Export sceUserServiceGetUserIdByNpAccountId, mapping the default account id (0) to USER_SERVICE_INITIAL_USER_ID and returning USER_SERVICE_ERROR_UNKNOWN_USER for other IDs.
- Export sceUserServiceGetUserIdByUserName, resolving USER_SERVICE_INITIAL_USER_NAME ("Player") to USER_SERVICE_INITIAL_USER_ID and returning USER_SERVICE_ERROR_UNKNOWN_USER for unknown names.
- Add test coverage in GuestUserService.cpp validating success returns and boundary error handling.
- Record single-user state and identifier mappings in TechnicalDebt.md.
@ErenYeager1836
ErenYeager1836 force-pushed the feat/userservice-status-and-account-id branch from 37f2311 to fa40c39 Compare October 12, 2026 19:32
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing: no title is shown calling sceUserServiceGetUserStatus, sceUserServiceGetUserIdByNpAccountId or sceUserServiceGetUserIdByUserName, and the signatures, the status value 1 and the error codes have no source. Reopen with the title ID and the log line where it stops on main, and where the values come from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants