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

Merged
tv7 merged 2 commits from upstream-pr/369 into main 2026-10-06 20:58:04 +00:00
tv7 commented 2026-10-02 15:56:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tv7 on 2026-10-02T15:56:12Z.


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)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4718545589 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/369). Originally posted by [tv7](https://github.com/tv7) on 2026-10-02T15:56:12Z. --- ### 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 - [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 (Claude Opus 5.5)
github-actions[bot] commented 2026-10-04 05:33:33 +00:00 (Migrated from github.com)

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


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
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5976964628 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/369#issuecomment-5976964628). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-04T05:33:33Z. --- <!-- progress-report --> ### Progress report (481c85e → fcd349f) 📈 **System libraries**: 82.36% (+0.05%, +9 implemented functions) <details> <summary>✅ 9 implemented</summary> | Library | Name | | - | - | | libSceJson2 | `_ZN3sce4Json11Initializer10initializeEPKNS0_14InitParameter2E` | | libSceJson2 | `_ZN3sce4Json14InitParameter212setAllocatorEPNS0_12MemAllocatorEPv` | | libSceJson2 | `_ZN3sce4Json14InitParameter217setFileBufferSizeEm` | | libSceJson2 | `_ZN3sce4Json14InitParameter2C1Ev` | | libSceJson2 | `_ZN3sce4Json5Value10referValueEm` | | libSceJson2 | `_ZN3sce4Json5ValueC1ENS0_9ValueTypeE` | | libSceJson2 | `_ZNK3sce4Json5Value8getValueERKNS0_6StringE` | | libSceJson2 | `_ZNK3sce4Json5Value8getValueEm` | | libSceJson2 | `_ZNK3sce4Json6Object4sizeEv` | </details>
oneandonlydean commented 2026-10-04 05:43:17 +00:00 (Migrated from github.com)

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


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5977024030 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/369#issuecomment-5977024030). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-04T05:43:17Z. --- 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[bot] commented 2026-10-04 23:45:06 +00:00 (Migrated from github.com)

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


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
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5985710232 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/369#issuecomment-5985710232). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-04T23:45:06Z. --- <!-- pr-overlap --> 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`<br>`_ZN3sce4Json14InitParameter217setFileBufferSizeEm` | | | #545 | | `_ZN3sce4Json11Initializer10initializeEPKNS0_14InitParameter2E`<br>`_ZN3sce4Json14InitParameter217setFileBufferSizeEm` | | | #803 | `docs/dev/TechnicalDebt.md` [L134](https://github.com/boykopovar/AnyPS5/blob/5b359092d850a496ae50e4e60b8c674cb4f921c1/docs/dev/TechnicalDebt.md#L134) | | | | #807 | `docs/dev/TechnicalDebt.md` [L134](https://github.com/boykopovar/AnyPS5/blob/5b359092d850a496ae50e4e60b8c674cb4f921c1/docs/dev/TechnicalDebt.md#L134) | | | | #953 | `docs/dev/TechnicalDebt.md` [L134](https://github.com/boykopovar/AnyPS5/blob/5b359092d850a496ae50e4e60b8c674cb4f921c1/docs/dev/TechnicalDebt.md#L134) | | |
tv7 commented 2026-10-05 15:57:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tv7 on 2026-10-05T15:57:35Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5998117855 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/369#issuecomment-5998117855). Originally posted by [tv7](https://github.com/tv7) on 2026-10-05T15:57:35Z. --- 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 commented 2026-10-06 05:34:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T05:34:05Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6010063281 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/369#issuecomment-6010063281). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-06T05:34:05Z. --- 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.
oneandonlydean commented 2026-10-06 09:27:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T09:27:50Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6013354791 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/369#issuecomment-6013354791). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-06T09:27:50Z. --- 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.
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!369
No description provided.