feat(libSceSaveData): answer sceSaveDataDirNameSearch2 #4220

Merged
xXPBSXx merged 1 commit from upstream-pr/4220 into main 2026-10-12 21:04:56 +00:00
xXPBSXx commented 2026-10-12 01:42:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T01:42:36Z.


What

sceSaveDataDirNameSearch2 (PPSA30601, Resonance; next stop after #4101/#4207 and #3737, see #4067) throws as a stub declared by #3814. This PR makes it run the same search as sceSaveDataDirNameSearch with the same condition and result structures: filter by name pattern, sort key and order, hit_num/set_num, unknown sort key or order returns the parameter error.

Origin: SharpEmu registers sceSaveDataDirNameSearch2 on the same implementation as sceSaveDataDirNameSearchPs4/sceSaveDataDirNameSearch (same (cond, result) arguments). That is the only source I found for the signature, so the assumption that both calls take the same structures rests on it; what distinguishes the 2 variant on a console is unknown. Throwing (the current stub) is the alternative if a reviewer prefers that until a second source exists.

Tested

  • Windows, MinGW GCC, Release: guest_savedata_search (new checks: the second search returns all three saves, sorts by user parameter descending like the first and rejects an unknown sort key) and the other 12 savedata tests pass; the new test aborts without the change because the stub throws. tools/check_conventions.py --base upstream/main passes.
  • PPSA30601 was run up to this stop with a local merge of #4101, #4207, #3737, #3814, #3799 and #3824; it is not re-run with this PR yet. Not tested on a console.

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: #3814 (declares the stub; the diff here includes its commits until it is merged)
  • AI-assisted: yes (Claude Code)

AI-assisted (Claude Code).
🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4823945174 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4220). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-12T01:42:36Z. --- ### What `sceSaveDataDirNameSearch2` (PPSA30601, Resonance; next stop after #4101/#4207 and #3737, see #4067) throws as a stub declared by #3814. This PR makes it run the same search as `sceSaveDataDirNameSearch` with the same condition and result structures: filter by name pattern, sort key and order, `hit_num`/`set_num`, unknown sort key or order returns the parameter error. Origin: [SharpEmu](https://github.com/sharpemu/sharpemu/blob/main/src/SharpEmu.Libs/SaveData/SaveDataExports.cs) registers `sceSaveDataDirNameSearch2` on the same implementation as `sceSaveDataDirNameSearchPs4`/`sceSaveDataDirNameSearch` (same `(cond, result)` arguments). That is the only source I found for the signature, so the assumption that both calls take the same structures rests on it; what distinguishes the `2` variant on a console is unknown. Throwing (the current stub) is the alternative if a reviewer prefers that until a second source exists. ### Tested - Windows, MinGW GCC, Release: `guest_savedata_search` (new checks: the second search returns all three saves, sorts by user parameter descending like the first and rejects an unknown sort key) and the other 12 `savedata` tests pass; the new test aborts without the change because the stub throws. `tools/check_conventions.py --base upstream/main` passes. - PPSA30601 was run up to this stop with a local merge of #4101, #4207, #3737, #3814, #3799 and #3824; it is not re-run with this PR yet. Not tested on a console. ### 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: #3814 (declares the stub; the diff here includes its commits until it is merged) - [x] AI-assisted: yes (Claude Code) AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-12 01:43:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T01:43:01Z.


Progress report (5ccb19b → 989504e)

📈 System libraries: 87.4% (+0.03%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceSaveData.native sceSaveDataDirNameSearch2
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6116261453 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4220#issuecomment-6116261453). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T01:43:01Z. --- <!-- progress-report --> ### Progress report (5ccb19b → 989504e) 📈 **System libraries**: 87.4% (+0.03%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceSaveData.native | `sceSaveDataDirNameSearch2` | </details>
blawesom commented 2026-10-12 15:27:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-12T15:27:01Z.


Rebase handoff — rebased onto current main, authorship unchanged (staleness only — the rebase applied cleanly).

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 957/957 passed

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/4220
git checkout <your branch>
git merge --ff-only FETCH_HEAD
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6127323988 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4220#issuecomment-6127323988). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-12T15:27:01Z. --- **Rebase handoff** — rebased onto current `main`, authorship unchanged (staleness only — the rebase applied cleanly). Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): - builds; `tools/check_conventions.py --base origin/main` passes - **full suite: 957/957 passed** **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/4220 git checkout <your branch> git merge --ff-only FETCH_HEAD ```
xXPBSXx commented 2026-10-12 17:56:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T17:56:38Z.


Thanks for the rebase and the full-suite run. I had already rebased this branch onto main 2a5eca11c before I saw your handoff (head 3cf45a101), so there is nothing to pick up. Your 957/957 on Linux is a useful second platform; on Windows the same state passes guest_savedata_search (1/1).

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6129698885 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4220#issuecomment-6129698885). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-12T17:56:38Z. --- Thanks for the rebase and the full-suite run. I had already rebased this branch onto `main` `2a5eca11c` before I saw your handoff (head `3cf45a101`), so there is nothing to pick up. Your 957/957 on Linux is a useful second platform; on Windows the same state passes `guest_savedata_search` (1/1). AI-assisted (Claude Code).
adriadam10 commented 2026-10-12 20:57:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T20:57:13Z.


Checked on Linux Release: build and the 30 tests of the touched directories pass, including guest_savedata_search, which fails without the change (stub throws). The new rows pin the three-save result, descending user-parameter order and the parameter error for an unknown key; the TechnicalDebt entry records that SharpEmu is the only source for the shared structures. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132478410 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4220#issuecomment-6132478410). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-12T20:57:13Z. --- Checked on Linux Release: build and the 30 tests of the touched directories pass, including `guest_savedata_search`, which fails without the change (stub throws). The new rows pin the three-save result, descending user-parameter order and the parameter error for an unknown key; the TechnicalDebt entry records that SharpEmu is the only source for the shared structures. Merging.
adriadam10 commented 2026-10-12 21:02:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T21:02:42Z.


Checked on Linux Release: build and the 30 tests of the touched directories pass, including guest_savedata_search, which fails without the change (stub throws). The new rows pin the three-save result, descending user-parameter order and the parameter error for an unknown key; the TechnicalDebt entry records that SharpEmu is the only source for the shared structures. Merging.

Rebased onto current main (only conflict: the PPSA30601 line in docs/dev/debt/libSceJson2.md, where I dropped the sceSaveDataDirNameSearch2 mention as before); build and the touched tests pass again.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132556854 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4220#issuecomment-6132556854). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-12T21:02:42Z. --- Checked on Linux Release: build and the 30 tests of the touched directories pass, including `guest_savedata_search`, which fails without the change (stub throws). The new rows pin the three-save result, descending user-parameter order and the parameter error for an unknown key; the TechnicalDebt entry records that SharpEmu is the only source for the shared structures. Merging. Rebased onto current `main` (only conflict: the PPSA30601 line in `docs/dev/debt/libSceJson2.md`, where I dropped the `sceSaveDataDirNameSearch2` mention as before); build and the touched tests pass again.
krishalivaibhav commented 2026-10-12 21:41:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-12T21:41:29Z.


Thanks for implementing this. We independently tested a minimal local sceSaveDataDirNameSearch2 forwarder to the existing native search implementation while bringing up Don't Starve Together (PPSA02070, 02.009.002) on an M2 Mac using Rosetta and MoltenVK. This was on an older runtime checkout, so it is corroborating evidence for the forwarding approach rather than a test of your exact merged revision.

The focused guest_savedata_search test passed with comparisons of Search1/Search2 counts and output at capacities 0/1/2, count-only queries, buffer canaries, long patterns and no matches, using an isolated temporary save directory. In the actual guest, the import bound successfully and Search2 returned hit_num=1, set_num=1; subsequent save mount/unmount operations succeeded.

The user observed a logo/audio during boot; gameplay has not been verified. Boot later stops in a separate graphics path because a vertex shader requests subgroup capability 61 on the Mac target. This report does not establish console ABI equivalence, PS5-specific Search2 differences, or correctness of the additional sorting behavior in your merged PR. No game files or save data are attached.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6133129002 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4220#issuecomment-6133129002). Originally posted by [krishalivaibhav](https://github.com/krishalivaibhav) on 2026-10-12T21:41:29Z. --- Thanks for implementing this. We independently tested a minimal local `sceSaveDataDirNameSearch2` forwarder to the existing native search implementation while bringing up Don't Starve Together (PPSA02070, 02.009.002) on an M2 Mac using Rosetta and MoltenVK. This was on an older runtime checkout, so it is corroborating evidence for the forwarding approach rather than a test of your exact merged revision. The focused `guest_savedata_search` test passed with comparisons of Search1/Search2 counts and output at capacities 0/1/2, count-only queries, buffer canaries, long patterns and no matches, using an isolated temporary save directory. In the actual guest, the import bound successfully and Search2 returned `hit_num=1`, `set_num=1`; subsequent save mount/unmount operations succeeded. The user observed a logo/audio during boot; gameplay has not been verified. Boot later stops in a separate graphics path because a vertex shader requests subgroup capability 61 on the Mac target. This report does not establish console ABI equivalence, PS5-specific Search2 differences, or correctness of the additional sorting behavior in your merged PR. No game files or save data are attached.
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!4220
No description provided.