Skip to content

fix(libSceNpUniversalDataSystem): return the module's codes from sceNpUniversalDataSystemInitialize - #16324

Open
sherySJ wants to merge 1 commit into
boykopovar:mainfrom
sherySJ:agent/uds-initialize-codes
Open

sherySJ wants to merge 1 commit into
boykopovar:mainfrom
sherySJ:agent/uds-initialize-codes

Conversation

@sherySJ

@sherySJ sherySJ commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What

sceNpUniversalDataSystemInitialize (core/libs/prx/libSceNpUniversalDataSystem/src/System.cpp:12) threw std::invalid_argument for a null param and for any size != 16, which ends the title, and returned 0 for pool_size == 0. The native module returns a code in all three cases.

Source: docs/dev/debt/libSceNpUniversalDataSystem.md:26 and the table in #12803 (comment), which @BunnyFl posted (thank you). It is a run of the 13.42 libSceNpUniversalDataSystem.sprx (function at 0x1ae0) in a host harness on Windows, not on a console, three identical runs. The module's own start routine failed in the harness and two setup steps were run by hand, so only the error returns come from the module.

Call Result
param == NULL 0x80553102
size 0, 8, 0xf, 0x11, 0x18, 0x20, 0x100, ~0 (pool_size 0x10000) 0x80553112
size 0x10, pool_size 0 0x80553102
size 0x18, pool_size 0 0x80553112
size 0x10, pool_size 0x10000 0

The checks run null, then size, then pool_size. The function now returns these codes in that order (NpUniversalDataSystem.hpp gets SCE_NP_UNIVERSAL_DATA_SYSTEM_ERROR_INVALID_PARAM_SIZE = 0x80553112). The queries test asserts every row above. The initialized state (0x80553118 on a repeated call) stays unimplemented and is the only thing left in the debt entry at line 26, with the #12803 comment as its source.

Tested

  • Linux, GCC 16.2.1, cmake --build build --target guest_np_uds_queries_tests, ctest -R '^guest_np_uds_queries$' run three times on the head: Passed each time.
  • Negative control: main's System.cpp with this test aborts (terminate called after throwing an instance of 'std::invalid_argument', what(): sceNpUniversalDataSystemInitialize: invalid argument) on the first row, the null param. On main the wrong-size rows also throw and the pool_size 0 row returns 0. The head passes.
  • python3 tools/check_conventions.py --base origin/main: passed.
  • Windows: @JJenkx ran guest_np_uds_queries 3 of 3 passing on Windows 11 with GCC 15.2 UCRT (comment). The values come from a module run, not a console.

Overlap

Base e509b29247. Open PRs touching docs/dev/debt/libSceNpUniversalDataSystem.md elsewhere: #14912, #13606, #14212 (draft), #14330. git merge-tree of this head with #14912, #13606 and #14330 is clean; #14212 already conflicts with main in tools/debt_split.py and not in these files. No open PR touches System.cpp or GuestNpUniversalDataSystemQueries.cpp.

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 under Silent stubs in their library's technical debt file
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

…pUniversalDataSystemInitialize

sceNpUniversalDataSystemInitialize threw std::invalid_argument for a null
param and for any size other than 16, which ends the title, and returned 0
for pool_size == 0. A 13.42 module run returns codes for all three.

Source: docs/dev/debt/libSceNpUniversalDataSystem.md line 26 and the table
in boykopovar#12803 (comment).
That table is a run of libSceNpUniversalDataSystem.sprx (13.42, function at
0x1ae0) in a host harness on Windows, not on a console, 3 identical runs:
null param returns 0x80553102; size 0, 8, 0xf, 0x11, 0x18, 0x20, 0x100 and
~0 with pool_size 0x10000 return 0x80553112; size 0x10 with pool_size 0
returns 0x80553102; size 0x18 with pool_size 0 returns 0x80553112; size
0x10 with pool_size 0x10000 returns 0. The checks run null, size, pool_size.

Initialize now returns those codes in that order. The initialized state
(0x80553118 on a repeated call) stays unimplemented and stays in the debt
entry, which now states only that gap.

The queries test asserts every row of the table that does not need the
initialized state. With the old System.cpp it aborts on the first null row
with the invalid_argument exception.
@JJenkx

JJenkx commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Windows check of head f68e23b4d7, which already contains main e509b29247.

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.

  • guest_np_uds_queries passes in 3 of 3 runs, none skipped.

AI-assisted: yes.

This branch has not been deployed

No deployments
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.

2 participants