Skip to content

feat(libSceJson2): implement typed construction, indexed and keyed value access, InitParameter2 - #369

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
tv7:feat/json2-value-access
Oct 6, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
tv7:feat/json2-value-access

Conversation

@tv7

@tv7 tv7 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

What

Nine libSceJson2 exports that had no definition on main:

  • Value::Value(ValueType) constructs a value of the given type.
  • Value::getValue(size_t) and Value::getValue(const String&) return the element or member, or the null-access result when it is missing, as operator[] does.
  • Value::referValue(size_t) returns the mutable array element, or null when the value is not an array or the index is out of range, as referValue(const String&) does for members.
  • Object::size returns the member count.
  • InitParameter2 (the class form of InitParameter): the constructor zeroes it, setAllocator and setFileBufferSize record their arguments, and Initializer::initialize(const InitParameter2*) succeeds as initialize(const InitParameter*) does. The layout stays within the 40 bytes a title reserves for it on the stack.

guest_json gains a test covering each of them: construction of every type, keyed and indexed reads including missing members and out-of-range indices, writing through referValue(size_t), and the recorded InitParameter2 fields.

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0 (winlibs ucrt posix seh): full build and ctest, 107/107 passed.
  • The same functions were used by Spirit of the Island (PPSA13934) and PRAGMATA (PPSA02530) in a fork, where their PSN and Json code paths call them during boot.

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 (Claude Opus 5.5)

@github-actions github-actions Bot added prx needs rebase Conflicts with main, rebase needed labels Oct 2, 2026
@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Progress report (481c85e → fcd349f)

📈 System libraries: 82.36% (+0.05%, +9 implemented functions)

✅ 9 implemented
Library Name
libSceJson2 _ZN3sce4Json11Initializer10initializeEPKNS0_14InitParameter2E
libSceJson2 _ZN3sce4Json14InitParameter212setAllocatorEPNS0_12MemAllocatorEPv
libSceJson2 _ZN3sce4Json14InitParameter217setFileBufferSizeEm
libSceJson2 _ZN3sce4Json14InitParameter2C1Ev
libSceJson2 _ZN3sce4Json5Value10referValueEm
libSceJson2 _ZN3sce4Json5ValueC1ENS0_9ValueTypeE
libSceJson2 _ZNK3sce4Json5Value8getValueERKNS0_6StringE
libSceJson2 _ZNK3sce4Json5Value8getValueEm
libSceJson2 _ZNK3sce4Json6Object4sizeEv

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks for these. Two things before it can go in. It no longer merges into current main: libSceJson2/Export.cpp conflicts with the nesting limit and the Cyberpunk exports that landed since, so it needs a rebase. And the InitParameter2 layout (allocator, user data, file buffer size) is inferred rather than known, so could you add a line for it under "Unknown function info" in docs/dev/TechnicalDebt.md, the way the other assumed layouts are recorded? The accessors themselves look right to me.

@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#407 _ZN3sce4Json11Initializer10initializeEPKNS0_14InitParameter2E
_ZN3sce4Json14InitParameter217setFileBufferSizeEm
#545 _ZN3sce4Json11Initializer10initializeEPKNS0_14InitParameter2E
_ZN3sce4Json14InitParameter217setFileBufferSizeEm
#803 docs/dev/TechnicalDebt.md L134
#807 docs/dev/TechnicalDebt.md L134
#953 docs/dev/TechnicalDebt.md L134

@tv7

tv7 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review, both are done:

  • Rebased onto current main. The only conflict was the sceJson2Unknown00 stub at the end of libSceJson2/Export.cpp; both are kept. The nesting limit and Cyberpunk exports merged cleanly. Full build and all 288 ctest tests pass locally.
  • Added the InitParameter2 layout under "Unknown function info" in docs/dev/TechnicalDebt.md (separate commit d22180d).

The CI runs for the new head are waiting for workflow approval.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks, both points are done: the rebase keeps the sceJson2Unknown00 stub next to your exports, and the InitParameter2 layout is recorded under "Unknown function info".

Since then, main has added four lines at the end of that list (_sceUlobjmgrRegisterObject, sceShareGetCurrentStatus, sceAgcDcbSet*PredicationEnableGetSize and Resource registration), so docs/dev/TechnicalDebt.md conflicts again. Keeping those and adding your line after them resolves it.

On #407: it still declares sce::Json::Initializer::initialize and InitParameter2::setFileBufferSize as throwing stubs. I've asked there for them to be dropped, since this PR implements both.

tv7 and others added 2 commits October 6, 2026 08:54
…lue access, InitParameter2

Value(ValueType) constructs a value of the given type. getValue(index) and
getValue(String) return the element or member, or the null-access result when
it is missing, as operator[] does. referValue(index) returns the mutable array
element, or null when the value is not an array or the index is out of range,
as referValue(String) does for members. Object::size returns the member count.

InitParameter2 is the class form of InitParameter: its constructor zeroes it,
setAllocator and setFileBufferSize record their arguments, and
Initializer::initialize(InitParameter2) succeeds as
initialize(InitParameter) does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tv7
tv7 force-pushed the feat/json2-value-access branch from d22180d to fcd349f Compare October 6, 2026 05:55
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 6, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks, the rebase is exactly that: main's lines at the end of "Unknown function info" are kept, your InitParameter2 line follows them, and the code commit is unchanged. It merges cleanly with main now.

oneandonlydean pushed a commit that referenced this pull request Oct 6, 2026
PPSA12544's Media/Plugins modules (CommonDialog, PSN, Share) import
libSceVrSetupDialog, which no library provided, and Share, NpTrophy2,
WebBrowserDialog and NpEntitlementAccess functions that were not
exported. Add libSceVrSetupDialog and the missing functions as
unimplemented exports, except
sceNpEntitlementAccessRequestConsumeServiceEntitlement, which reports
SCE_NP_ERROR_SIGNED_OUT like
sceNpEntitlementAccessRequestConsumeUnifiedEntitlement. Their other
imports are covered by #734 and #369, and two by #407.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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