Skip to content

feat(npcppwebapi): add InGameCatalog V5 Container and Sku accessors - #19674

Closed
akkadbakkad89 wants to merge 1 commit into
boykopovar:mainfrom
akkadbakkad89:feat/npcppwebapi-ingamecatalog-v5
Closed

akkadbakkad89 wants to merge 1 commit into
boykopovar:mainfrom
akkadbakkad89:feat/npcppwebapi-ingamecatalog-v5

Conversation

@akkadbakkad89

Copy link
Copy Markdown
Contributor

What

Implements the eight sce::Np::CppWebApi::InGameCatalog::V5 accessors that the eboot of GTASA (PPSA03524) statically imports from libSceNpCppWebApi and that main did not export:

  • Container::getLabel, Container::getDisplayName, Container::getReleaseDate, Container::releaseDateIsSet, Container::getSkus, Container::skusIsSet
  • Sku::getEndDate, Sku::endDateIsSet

All eight are plain member accessors in the SDK module (lea/movzx/ret or a small IntrusivePtr-copy tail), so they read fields directly rather than throwing: six return non-owning member pointers or read a boolean flag byte, and getSkus copies the IntrusivePtr<Vector<...>> member into the out object while retaining the pointee (through the existing CopyMemberIntrusivePtr helper, vector reference count at +0x30).

Proof / offsets (title modules, not guessed)

Measured by static disassembly of the converted sce_module/libSceNpCppWebApi.prx copies bundled with the title dumps:

accessor PPSA20397 (J03093737) PPSA30528 (J03547048) impl
Container::getLabel lea rax,[rdi+0x58] lea rax,[rdi+0x58] +0x58
Container::getDisplayName lea rax,[rdi+0x88] lea rax,[rdi+0x88] +0x88
Container::getReleaseDate lea rax,[rdi+0xa8] lea rax,[rdi+0xa8] +0xa8
Container::releaseDateIsSet movzx eax,byte[rdi+0xc8] movzx eax,byte[rdi+0xc8] +0xc8
Container::getSkus reads [rsi+0x208] into out + retains +0x30 refcount same +0x208, refcount +0x30
Container::skusIsSet movzx eax,byte[rdi+0x220] movzx eax,byte[rdi+0x220] +0x220
Sku::getEndDate lea rax,[rdi+0x88] lea rax,[rdi+0x88] +0x88
Sku::endDateIsSet movzx eax,byte[rdi+0xa8] movzx eax,byte[rdi+0xa8] +0xa8

Two independent SDK builds agree byte-for-byte on every offset. The demanding title (GTASA, build J01397853) belongs to the same J03xxx-generation family — this layout is also the one the already-landed Container::getChildren (vector handle at +0x228) uses.

A second, older measured family (PPSA03530's bundled copy) lays out the Container fields differently (+0x30/+0x60/+0x80/+0xa0/+0x1e0/+0x1f8); that divergence and its build-family boundary are now recorded in docs/dev/debt/libSceNpCppWebApi.md. Sku is stable across all measured builds.

Demand evidence: GTASA's eboot import registry (PPSA03524) lists exactly these 14 libSceNpCppWebApi imports; the six siblings it also imports were already exported, leaving this coherent Container/Sku family missing.

Tested

  • Windows 11, MinGW GCC 15.2: libSceNpCppWebApi builds clean; patched .prx exports all 8 NIDs (BhaIhoxXkGk, q8iKymW1wQU, jU2YUZ4YNvY, LaelDFxAfXE, hUZIRxBcMGU, zWkArFP1YQI, JUBOIzusdEw, YL67CqoAxos), verified against the PE export table.
  • New guest_np_cpp_web_api_in_game_catalog_v5 test passes: asserts each pointer-returning accessor lands on the measured member offset, each *IsSet reads its flag byte (set/clear/set transitions), and getSkus returns the out pointer, copies object/deleter/context, retains the pointee (refcount 7 -> 8), and does not mutate the member.
  • ctest -R np_cpp_web_api: 19/19 pass.
  • python3 tools/check_conventions.py --base origin/main: clean.
  • python3 tools/pr_overlap.py --branch feat/npcppwebapi-ingamecatalog-v5: no overlap with open PRs.

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: PPSA03524 (GTASA eboot imports)
  • GPUs tested: n/a
  • AI-assisted: yes

@PrivacyOnion PrivacyOnion left a comment

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.

Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 838ca51cee:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: guest_np_cpp_web_api_ingame_catalog_v5_tests built cleanly.
  • CTest (guest_np_cpp_web_api_ingame_catalog_v5):
    1/1 Test #890: guest_np_cpp_web_api_ingame_catalog_v5 ...Subprocess aborted***Exception:   0.50 sec
    0% tests passed, 1 tests failed out of 1
    
    The following tests FAILED:
    
  • Note: the AI-assisted checkbox can stay.

Requesting changes for the points above.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@akkadbakkad89
akkadbakkad89 force-pushed the feat/npcppwebapi-ingamecatalog-v5 branch from 838ca51 to 8e5ed97 Compare November 13, 2026 19:43
@akkadbakkad89

Copy link
Copy Markdown
Contributor Author

Verified — the abort was a real defect in the test, not the library. The Container object needs 0x221 bytes (the skusIsSet flag at +0x220), but the second loop iteration placed it at storage + 512 inside a 1024-byte array, so the flag writes at +0x220 and the IntrusivePtr copy at +0x208 wrote past the end. Windows let it slide; Ubuntu's default -fstack-protector-strong/FORTIFY aborts on the overwrite, matching your "Subprocess aborted" Release result.

Fixed in 8e5ed97: the storage is now two proper 0x240-byte slots (0x480 total, offsets {0, 0x240}) so every container access stays in bounds. Rebuilt and re-ran guest_np_cpp_web_api_ingame_catalog_v5 on Windows/MinGW — passes. check_conventions clean.

Generated with Devin

@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Nov 13, 2026
@c1b3r-p3d1a

Copy link
Copy Markdown
Contributor

Linux test report for 8e5ed97, merged onto main 1edac2f. Ubuntu 24.04 under WSL2, GCC 13.3.0, glibc 2.39, Ninja, Release, BUILD_TESTING=ON.

  • ninja -C build guest_np_cpp_web_api_ingame_catalog_v5_tests, then ctest -R '^guest_np_cpp_web_api_ingame_catalog_v5$' --output-on-failure: passed (1/1).

Your Tested section only covers Windows, so this adds the Linux build. One small thing: the body calls the test guest_np_cpp_web_api_in_game_catalog_v5, but the target and test registered in core/libs/CMakeLists.txt are guest_np_cpp_web_api_ingame_catalog_v5 (no underscore in "ingame"). Copying the name from the description gives ninja: unknown target. I did not check the member offsets: they need the module, which I don't have.

@JJenkx

JJenkx commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Windows check of head 8e5ed977f2, merged onto main 752c0f776b (a48c259f4d, clean merge).

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_cpp_web_api_ingame_catalog_v5 passes in 3 of 3 runs, none skipped.

AI-assisted: yes.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Exports with a name or library/NID already present in main:

  • _ZN3sce2Np9CppWebApi13InGameCatalog2V59Container7getSkusEv (same library/NID already present: core/libs/prx/libSceNpCppWebApi (hUZIRxBcMGU))
  • _ZNK3sce2Np9CppWebApi13InGameCatalog2V53Sku10getEndDateEv (same library/NID already present: core/libs/prx/libSceNpCppWebApi (JUBOIzusdEw))
  • _ZNK3sce2Np9CppWebApi13InGameCatalog2V53Sku12endDateIsSetEv (same library/NID already present: core/libs/prx/libSceNpCppWebApi (YL67CqoAxos))
  • _ZNK3sce2Np9CppWebApi13InGameCatalog2V59Container14getDisplayNameEv (same library/NID already present: core/libs/prx/libSceNpCppWebApi (BhaIhoxXkGk))
  • _ZNK3sce2Np9CppWebApi13InGameCatalog2V59Container14getReleaseDateEv (same library/NID already present: core/libs/prx/libSceNpCppWebApi (jU2YUZ4YNvY))
  • _ZNK3sce2Np9CppWebApi13InGameCatalog2V59Container16releaseDateIsSetEv (same library/NID already present: core/libs/prx/libSceNpCppWebApi (LaelDFxAfXE))
  • _ZNK3sce2Np9CppWebApi13InGameCatalog2V59Container8getLabelEv (same library/NID already present: core/libs/prx/libSceNpCppWebApi (q8iKymW1wQU))
  • _ZNK3sce2Np9CppWebApi13InGameCatalog2V59Container9skusIsSetEv (same library/NID already present: core/libs/prx/libSceNpCppWebApi (zWkArFP1YQI))
    Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
Pull request Shared files not compared
PR 7275 core/libs/CMakeLists.txt
PR 8650 core/libs/CMakeLists.txt
PR 9156 core/libs/CMakeLists.txt
PR 9293 core/libs/CMakeLists.txt
PR 9297 core/libs/CMakeLists.txt
PR 9302 core/libs/CMakeLists.txt
PR 9383 core/libs/CMakeLists.txt
PR 12642 core/libs/CMakeLists.txt
PR 16793 core/libs/CMakeLists.txt
PR 17452 core/libs/CMakeLists.txt
PR 17496 core/libs/CMakeLists.txt

@github-actions

Copy link
Copy Markdown

Progress report (135da47 → 8e5ed97)

📈 System libraries: 40.06% (+0.01%, +8 implemented functions)

✅ 8 implemented
Library Name
libSceNpCppWebApi _ZN3sce2Np9CppWebApi13InGameCatalog2V59Container7getSkusEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi13InGameCatalog2V53Sku10getEndDateEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi13InGameCatalog2V53Sku12endDateIsSetEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi13InGameCatalog2V59Container14getDisplayNameEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi13InGameCatalog2V59Container14getReleaseDateEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi13InGameCatalog2V59Container16releaseDateIsSetEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi13InGameCatalog2V59Container8getLabelEv
libSceNpCppWebApi _ZNK3sce2Np9CppWebApi13InGameCatalog2V59Container9skusIsSetEv

Changed libraries (implemented exports)

Library Before After Change
libSceNpCppWebApi 1342/1778 (75.48%) 1350/1786 (75.59%) +0.11%

@akkadbakkad89

Copy link
Copy Markdown
Contributor Author

Closing as superseded — every export this PR adds is now present on main via #13206 (the pr-overlap report above lists all eight: Container::getLabel, getDisplayName, getReleaseDate, releaseDateIsSet, getSkus, skusIsSet, Sku::getEndDate, endDateIsSet, same library/NID each). Main's implementation uses the same field offsets and semantics, and core/libs/tests/GuestNpCppWebApiCatalogLeaderboards.cpp covers all eight functions, so this PR no longer adds coverage.

@PrivacyOnion — for the record, the Subprocess aborted you saw was a real test bug and was already fixed at 8e5ed977f2 (the Container object needs 0x221 bytes; the old storage slots under-allocated and Ubuntu's stack protector caught it). Your run was on the earlier head 838ca51cee; the abort does not reproduce on the fixed head, which is also what @c1b3r-p3d1a's and @JJenkx's reports on 8e5ed977f2 show.

Thanks to everyone who ran it — the buffer-overflow catch and the Linux datapoints were still useful, and the test fix is carried in this branch's history if any part is ever resurrected.

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

Labels

build docs prx unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants