feat(libSceJson2): implement sce::Json::String methods and npos #5439

Merged
mariusyo07 merged 1 commit from upstream-pr/5439 into main 2026-10-14 23:14:13 +00:00
mariusyo07 commented 2026-10-13 19:45:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mariusyo07 on 2026-10-13T19:45:01Z.


What

Implements sce::Json::String member functions (find, rfind, substr, append, clear, reserve) and static member npos in libSceJson2.

METAL GEAR SOLID: Peace Walker - Master Collection Version (PPSA18216) stops on main when relinking mgspw.elf (#5268):

FAIL: unresolved ELF import pCF8Ohwre44 from libSceJson2.prx

pCF8Ohwre44 is _ZN3sce4Json6String4nposE. The binary also links the corresponding string manipulation methods:

  • find / rfind: searches for character starting from given position, returning npos on failure.
  • substr: returns substring copy, throwing std::out_of_range if the starting position exceeds string length.
  • append: appends a string or C string, throwing std::invalid_argument on null pointer.
  • clear / reserve: clears string and reserves buffer capacity.

Tested

  • Linux (GCC 16.1.1): core/libs/prx/libSceJson2/Export.cpp and core/libs/tests/GuestJson.cpp compile cleanly.
  • guest_json_tests in GuestJson.cpp exercises StringMethods (npos, find, rfind, substr with bounds checks, reserve, both append overloads, and clear). The test fails to link on main without the exports.
  • python3 tools/check_conventions.py --base upstream/main: all checks passed.
  • git diff --check: passes with no whitespace or style warnings.
  • python3 tools/pr_overlap.py --branch feat/json-string-methods: no overlap with open pull requests.

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
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA18216 #5268
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4848566908 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5439). Originally posted by [mariusyo07](https://github.com/mariusyo07) on 2026-10-13T19:45:01Z. --- ### What Implements `sce::Json::String` member functions (`find`, `rfind`, `substr`, `append`, `clear`, `reserve`) and static member `npos` in libSceJson2. METAL GEAR SOLID: Peace Walker - Master Collection Version (PPSA18216) stops on `main` when relinking `mgspw.elf` (#5268): ``` FAIL: unresolved ELF import pCF8Ohwre44 from libSceJson2.prx ``` `pCF8Ohwre44` is `_ZN3sce4Json6String4nposE`. The binary also links the corresponding string manipulation methods: - `find` / `rfind`: searches for character starting from given position, returning `npos` on failure. - `substr`: returns substring copy, throwing `std::out_of_range` if the starting position exceeds string length. - `append`: appends a string or C string, throwing `std::invalid_argument` on null pointer. - `clear` / `reserve`: clears string and reserves buffer capacity. ### Tested - Linux (GCC 16.1.1): `core/libs/prx/libSceJson2/Export.cpp` and `core/libs/tests/GuestJson.cpp` compile cleanly. - `guest_json_tests` in `GuestJson.cpp` exercises `StringMethods` (`npos`, `find`, `rfind`, `substr` with bounds checks, `reserve`, both `append` overloads, and `clear`). The test fails to link on `main` without the exports. - `python3 tools/check_conventions.py --base upstream/main`: all checks passed. - `git diff --check`: passes with no whitespace or style warnings. - `python3 tools/pr_overlap.py --branch feat/json-string-methods`: no overlap with open pull requests. ### 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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA18216 #5268 - [x] GPUs tested: n/a - [x] AI-assisted: yes
copilot-pull-request-reviewer[bot] commented 2026-10-13 19:45:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-13T19:45:08Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5509052681 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5439#pullrequestreview-5509052681). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-10-13T19:45:08Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
github-actions[bot] commented 2026-10-13 19:45:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T19:45:55Z.


Progress report (2f1597b → 495b4f5)

📈 System libraries: 88.71% (+0.02%, +7 implemented functions)

✅ 7 implemented
Library Name
libSceJson2 _ZN3sce4Json6String5clearEv
libSceJson2 _ZN3sce4Json6String6appendEPKc
libSceJson2 _ZN3sce4Json6String6appendERKS1_
libSceJson2 _ZN3sce4Json6String7reserveEm
libSceJson2 _ZNK3sce4Json6String4findEcm
libSceJson2 _ZNK3sce4Json6String5rfindEcm
libSceJson2 _ZNK3sce4Json6String6substrEmm
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6153791241 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5439#issuecomment-6153791241). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-13T19:45:55Z. --- <!-- progress-report --> ### Progress report (2f1597b → 495b4f5) 📈 **System libraries**: 88.71% (+0.02%, +7 implemented functions) <details> <summary>✅ 7 implemented</summary> | Library | Name | | - | - | | libSceJson2 | `_ZN3sce4Json6String5clearEv` | | libSceJson2 | `_ZN3sce4Json6String6appendEPKc` | | libSceJson2 | `_ZN3sce4Json6String6appendERKS1_` | | libSceJson2 | `_ZN3sce4Json6String7reserveEm` | | libSceJson2 | `_ZNK3sce4Json6String4findEcm` | | libSceJson2 | `_ZNK3sce4Json6String5rfindEcm` | | libSceJson2 | `_ZNK3sce4Json6String6substrEmm` | </details>
simonbronk commented 2026-10-14 08:12:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-14T08:12:32Z.


Tested on Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release, full build, this PR (f2b135327) merged onto main 1209d3707 (AI-assisted: Claude Code).

  • With main's Export.cpp and the new test kept: guest_json_tests fails to link.
  • With this PR: guest_json passes 20/20 (--repeat until-fail:20), with the StringMethods checks.
  • Full non-GPU ctest: 637/638; the one failure is guest_memory, which fails intermittently on main here too.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6163933155 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5439#issuecomment-6163933155). Originally posted by [simonbronk](https://github.com/simonbronk) on 2026-10-14T08:12:32Z. --- Tested on Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release, full build, this PR (`f2b135327`) merged onto `main` `1209d3707` (AI-assisted: Claude Code). - With `main`'s `Export.cpp` and the new test kept: `guest_json_tests` fails to link. - With this PR: `guest_json` passes 20/20 (`--repeat until-fail:20`), with the `StringMethods` checks. - Full non-GPU `ctest`: 637/638; the one failure is `guest_memory`, which fails intermittently on `main` here too.
oneandonlydean commented 2026-10-14 22:15:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T22:15:55Z.


Rebased onto main (test list conflict); guest_json passes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6179698651 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5439#issuecomment-6179698651). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T22:15:55Z. --- Rebased onto main (test list conflict); `guest_json` passes.
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!5439
No description provided.