feat(libSceJson2): add sce::Json::Parser::parse with a read callback #3571

Merged
EdouardSence merged 1 commit from upstream-pr/3571 into main 2026-10-11 21:34:49 +00:00
EdouardSence commented 2026-10-11 13:30:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-11T13:30:15Z.


What

Adds sce::Json::Parser::parse(Value&, int (*)(char&, void*), void*) to libSceJson2. It is the overload that reads its text through a callback, one character at a time.

  • PPSA04540 (Rise of the Ronin, 01.009.000) imports it (itqj2YmuAa8). On main a11c8f7f the title has 8 missing imports, and its loader stops on the first of them: ./app.elf: symbol lookup error: ./app.elf: undefined symbol: uBIN24Tv2MI (#3559). This is one of the others.
  • No reference documents the callback's contract, so it is taken from the title's callback (0x3758280). It returns 0 with the next character in ch. At the end of its data it writes '\0' and returns -1.
  • The new overload reads until the callback returns non-zero or gives '\0', then parses that text with the existing (text, size) overload. Results, errors and the rejection of trailing characters are therefore the same as there.
  • The TechnicalDebt entry lists what remains unknown: whether the console stops reading at the end of the top-level value, and what it returns when the callback fails before the end.
  • guest_json's new StreamParse covers three cases: a valid document (every character read, end marker included), a truncated one, and one with a trailing value. On main it does not link.

Tested

Linux (CachyOS), RX 9070 XT, GCC, Release, on main a11c8f7f:

  • guest_json passes.
  • With this PR, #3559, #3560 and #3570 together, PPSA04540 has no missing import left. It loads and runs to its next stop, NGS2: system option flags are not implemented.

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

Tested and written by Claude (AI assistant) on a contributor's machine.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4819415164 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3571). Originally posted by [EdouardSence](https://github.com/EdouardSence) on 2026-10-11T13:30:15Z. --- ### What Adds `sce::Json::Parser::parse(Value&, int (*)(char&, void*), void*)` to libSceJson2. It is the overload that reads its text through a callback, one character at a time. - PPSA04540 (Rise of the Ronin, 01.009.000) imports it (`itqj2YmuAa8`). On `main` a11c8f7f the title has 8 missing imports, and its loader stops on the first of them: `./app.elf: symbol lookup error: ./app.elf: undefined symbol: uBIN24Tv2MI` (#3559). This is one of the others. - No reference documents the callback's contract, so it is taken from the title's callback (`0x3758280`). It returns 0 with the next character in `ch`. At the end of its data it writes `'\0'` and returns -1. - The new overload reads until the callback returns non-zero or gives `'\0'`, then parses that text with the existing `(text, size)` overload. Results, errors and the rejection of trailing characters are therefore the same as there. - The TechnicalDebt entry lists what remains unknown: whether the console stops reading at the end of the top-level value, and what it returns when the callback fails before the end. - `guest_json`'s new `StreamParse` covers three cases: a valid document (every character read, end marker included), a truncated one, and one with a trailing value. On `main` it does not link. ### Tested Linux (CachyOS), RX 9070 XT, GCC, Release, on `main` a11c8f7f: - `guest_json` passes. - With this PR, #3559, #3560 and #3570 together, PPSA04540 has no missing import left. It loads and runs to its next stop, `NGS2: system option flags are not implemented`. ### 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 *Tested and written by Claude (AI assistant) on a contributor's machine.* 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-11 13:30:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T13:30:37Z.


Progress report (a11c8f7 → 95a92f3)

📈 System libraries: 85.82% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceJson2 _ZN3sce4Json6Parser5parseERNS0_5ValueEPFiRcPvES5_
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109544450 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3571#issuecomment-6109544450). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T13:30:37Z. --- <!-- progress-report --> ### Progress report (a11c8f7 → 95a92f3) 📈 **System libraries**: 85.82% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceJson2 | `_ZN3sce4Json6Parser5parseERNS0_5ValueEPFiRcPvES5_` | </details>
github-actions[bot] commented 2026-10-11 16:31:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T16:31:51Z.


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
#3721 docs/dev/TechnicalDebt.md L132
#3724 docs/dev/TechnicalDebt.md L132
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6111186479 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3571#issuecomment-6111186479). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T16:31:51Z. --- <!-- 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 | |---|---|---|---| | #3721 | `docs/dev/TechnicalDebt.md` [L132](https://github.com/boykopovar/AnyPS5/blob/1770f352d7546c1eae9cf1e1441e1ae2428dc3a0/docs/dev/TechnicalDebt.md#L132) | | | | #3724 | `docs/dev/TechnicalDebt.md` [L132](https://github.com/boykopovar/AnyPS5/blob/1770f352d7546c1eae9cf1e1441e1ae2428dc3a0/docs/dev/TechnicalDebt.md#L132) | | |
adriadam10 commented 2026-10-11 21:34:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T21:34:45Z.


Checked the build and guest_json (passes; without the change the test doesn't link), the three cases in StreamParse, and the TechnicalDebt entry (right section, documents the unknown callback contract); merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114028694 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3571#issuecomment-6114028694). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T21:34:45Z. --- Checked the build and `guest_json` (passes; without the change the test doesn't link), the three cases in `StreamParse`, and the TechnicalDebt entry (right section, documents the unknown callback contract); merging.
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!3571
No description provided.