feat(libSceSaveData): answer the save point, client priority and debug thread id calls as firmware 13.42 does #14908

Merged
BunnyFl merged 6 commits from upstream-pr/14908 into main 2026-11-07 03:28:25 +00:00
BunnyFl commented 2026-11-02 00:16:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-02T00:16:52Z.


What

Implements three libSceSaveData exports that threw, following firmware 13.42's libSceSaveData.sprx:

  • sceSaveDataGetSavePoint returns 2.
  • sceSaveDataGetClientThreadPriority returns 0.
  • sceSaveDataDebugGetThreadId returns 0.

Firmware code (13.42, text-segment offsets; read to the return, disassembly; also run natively, see Tested; not measured on a console):

0x37130 sceSaveDataGetSavePoint:             mov eax,0x2 ; ret
0x3a170 sceSaveDataGetClientThreadPriority:  xor eax,eax ; ret
0x3a180 sceSaveDataDebugGetThreadId:         xor eax,eax ; ret

None of them reads an argument or memory (the three bodies at 0x37130, 0x3a170 and 0x3a180 above), so the existing parameterless declarations stay: whatever a caller passes, nothing is read or written, as on 13.42. Only libSceSaveData.sprx exports these NIDs in 13.42 (libSceSaveData.native.sprx does not). The debt entry takes them out of the pending-declarations list and records what is still open: what the values mean and which arguments callers pass.

Tested

Merged main ad5a003138 into the branch; the head is now 593b690c87. The only conflict was in docs/dev/debt/libSceSaveData.native.md, where main had rewritten the sceSaveDataGetProgress entry (#15097) directly above the pending-declarations list this branch shortens; main's entry is kept, then this branch's shortened list and its new entry. The branch's added and removed lines against main are the same as before the merge, so the negative control below was not repeated.

  • On 593b690c87, Windows 11 Pro 10.0.26300, WinLibs GCC, Release: 81 of 81 pass, none Not Run, with the 11 executables behind the listed tests rebuilt: the 16 guest_savedata_* tests registered at this head (guest_savedata_constant_calls included), public_headers and the 64 public_headers_compile_* batches.
  • tools/check_conventions.py --base upstream/main on the committed head 593b690c87: no errors; one debt-length warning on the pending-declarations entry, which this branch shortens from 5,245 characters on main to 4,972.

Earlier runs:

Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0, Release, Ninja, BUILD_TESTING=ON, branch head 60b08f5f14 on main 66e1f7f993.

  • New guest_savedata_constant_calls calls each export three times against the patched libSceSaveData.native: passes 3 of 3.
  • Negative control: with main's libSceSaveData.native/Export.cpp, it aborts with 0xc0000409.
  • The other SaveData tests built here (guest_savedata_search, delete, convert, mount_status, ps4, cancel, host_space) and public_headers: pass.
  • Native run (not on a console): the three functions copied from the 13.42 module into executable memory and called through the System V ABI with four argument sets, including a pointer to a 0x5a-filled buffer: each returns its constant and the buffer is untouched, 0 mismatches.
  • python tools/check_conventions.py --base upstream/main: no errors; one debt-length warning on the pending-declarations entry, which is already over the limit on main (the figure then was 5604 characters; see the current one above).
  • python tools/pr_overlap.py --branch feat/libscesavedata-constant-calls: no open PR implements these exports (the tool's same-exports column is empty). #10674, #12625, #12748 and #13551 also edit the one-line pending-declarations list in docs/dev/debt/libSceSaveData.native.md (line 24), which every change to these stubs has to edit, so whichever merges later resolves that line by hand. #14212 (blank lines between debt entries) could not be compared automatically.

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 (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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5113000550 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14908). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-02T00:16:52Z. --- ### What Implements three libSceSaveData exports that threw, following firmware 13.42's `libSceSaveData.sprx`: - `sceSaveDataGetSavePoint` returns 2. - `sceSaveDataGetClientThreadPriority` returns 0. - `sceSaveDataDebugGetThreadId` returns 0. Firmware code (13.42, text-segment offsets; read to the return, disassembly; also run natively, see Tested; not measured on a console): ``` 0x37130 sceSaveDataGetSavePoint: mov eax,0x2 ; ret 0x3a170 sceSaveDataGetClientThreadPriority: xor eax,eax ; ret 0x3a180 sceSaveDataDebugGetThreadId: xor eax,eax ; ret ``` None of them reads an argument or memory (the three bodies at `0x37130`, `0x3a170` and `0x3a180` above), so the existing parameterless declarations stay: whatever a caller passes, nothing is read or written, as on 13.42. Only `libSceSaveData.sprx` exports these NIDs in 13.42 (`libSceSaveData.native.sprx` does not). The debt entry takes them out of the pending-declarations list and records what is still open: what the values mean and which arguments callers pass. ### Tested Merged `main` `ad5a003138` into the branch; the head is now `593b690c87`. The only conflict was in `docs/dev/debt/libSceSaveData.native.md`, where `main` had rewritten the `sceSaveDataGetProgress` entry (#15097) directly above the pending-declarations list this branch shortens; `main`'s entry is kept, then this branch's shortened list and its new entry. The branch's added and removed lines against `main` are the same as before the merge, so the negative control below was not repeated. - On `593b690c87`, Windows 11 Pro 10.0.26300, WinLibs GCC, Release: **81 of 81 pass, none Not Run**, with the 11 executables behind the listed tests rebuilt: the 16 `guest_savedata_*` tests registered at this head (`guest_savedata_constant_calls` included), `public_headers` and the 64 `public_headers_compile_*` batches. - `tools/check_conventions.py --base upstream/main` on the committed head `593b690c87`: no errors; one `debt-length` warning on the pending-declarations entry, which this branch shortens from 5,245 characters on `main` to 4,972. Earlier runs: Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0, Release, Ninja, `BUILD_TESTING=ON`, branch head `60b08f5f14` on `main` `66e1f7f993`. - New `guest_savedata_constant_calls` calls each export three times against the patched `libSceSaveData.native`: passes 3 of 3. - Negative control: with `main`'s `libSceSaveData.native/Export.cpp`, it aborts with `0xc0000409`. - The other SaveData tests built here (`guest_savedata_search`, `delete`, `convert`, `mount_status`, `ps4`, `cancel`, `host_space`) and `public_headers`: pass. - Native run (not on a console): the three functions copied from the 13.42 module into executable memory and called through the System V ABI with four argument sets, including a pointer to a `0x5a`-filled buffer: each returns its constant and the buffer is untouched, 0 mismatches. - `python tools/check_conventions.py --base upstream/main`: no errors; one `debt-length` warning on the pending-declarations entry, which is already over the limit on `main` (the figure then was 5604 characters; see the current one above). - `python tools/pr_overlap.py --branch feat/libscesavedata-constant-calls`: no open PR implements these exports (the tool's same-exports column is empty). #10674, #12625, #12748 and #13551 also edit the one-line pending-declarations list in `docs/dev/debt/libSceSaveData.native.md` (line 24), which every change to these stubs has to edit, so whichever merges later resolves that line by hand. #14212 (blank lines between debt entries) could not be compared automatically. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
XairRrR commented 2026-11-03 14:46:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T14:46:11Z.

Review: APPROVED


Reviewed — approved

sceSaveDataGetSavePoint, sceSaveDataGetClientThreadPriority and sceSaveDataDebugGetThreadId used to throw and now return 2, 0 and 0, as in the firmware 13.42 disassembly quoted in the description. The new test passes on the merged tree and fails when the production file is restored from main. The debt list is updated to match.

What I ran

Head 8f80305e9c4b7cdbbd073421b6fa0cd42741540a merged with --no-ff into main 4f41f4c375f5abb487dbd184fbc150f31994d762 (merged tree 431e9988e4b3e2bccb41f8353efa6c2c9ef45edf). Machine: Debian 13 VM, 32 vCPU (Xeon Gold 6136), GCC 14.2.0, Release, Ninja, BUILD_TESTING=ON.

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...8f80305e9c4b7cdbbd073421b6fa0cd42741540a
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ctest --test-dir build --output-on-failure -R "guest_savedata|public_headers" -j8 --test-load 32
# negative control
git show 4f41f4c375f5abb487dbd184fbc150f31994d762:core/libs/prx/libSceSaveData.native/Export.cpp > core/libs/prx/libSceSaveData.native/Export.cpp
ninja -C build -j32 -l32 guest_savedata_constant_calls_tests
ctest --test-dir build --output-on-failure -R "^guest_savedata_constant_calls$"
git show 431e9988e4b3e2bccb41f8353efa6c2c9ef45edf:core/libs/prx/libSceSaveData.native/Export.cpp > core/libs/prx/libSceSaveData.native/Export.cpp
ninja -C build -j32 -l32 guest_savedata_constant_calls_tests libSceSaveData.native
ctest --test-dir build -R "^guest_savedata_constant_calls$"
git status --porcelain

Results

Check Result
git diff --check clean
check_conventions.py 0 errors, 1 debt-length warning on the pending-declarations entry (4972 characters; it was already over the limit on main and this PR makes it shorter)
Configure / build / libs (script) ok
Selected tests (script) 2456 ran; no new failures, no timeouts. Known failures on main: guest_interfaces, guest_socket_options_multicast, unwrap_self_..._destination_directory_group, vector_constant_factor_tininess. The unexpected guest_net_ctl skip also happens on main.
guest_savedata_* (11 tests, including the new guest_savedata_constant_calls) + public_headers* 75/75 passed
Validation-layer comparison not applicable: no AGC, shader or VideoOut files changed
check_conventions.py
docs/dev/debt/libSceSaveData.native.md:26: warning: [debt-length] Technical debt entry over 1000 characters: ... 4972 characters
1 findings, 0 errors

Negative control

I restored only core/libs/prx/libSceSaveData.native/Export.cpp from main and rebuilt. guest_savedata_constant_calls then aborted:

output
terminate called after throwing an instance of 'std::runtime_error'
  what():  sceSaveDataGetSavePoint not implemented
0% tests passed, 1 tests failed out of 1
	3041 - guest_savedata_constant_calls (Subprocess aborted)

After I restored the merged file and rebuilt, the test passed again, and git status --porcelain came back empty.

Findings

Blocking

None.

Non-blocking

  • core/libs/prx/libSceSaveData.native/CMakeLists.txt:39: the new test is the only SaveData test that sets its own TIMEOUT 20, and it does not call configure_windows_unwind like the tests next to it. Neither is needed for a test that runs in 0.01 s and catches no exceptions. Dropping the timeout would keep the registration consistent with the others.
  • docs/dev/debt/libSceSaveData.native.md:27: the new entry leaves out the (libSceSaveData.native) tag that the entries around it carry. It is cosmetic.

Not verified

  • The firmware 13.42 disassembly and the native run in the description. I have no firmware module here, so the constants 2/0/0 and the claim that no argument or memory is read are taken from the description. The new test checks what the code does, not what the firmware does.
  • Windows behaviour. Linux GCC only.
  • No console measurement, as the description and the debt entry already state.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5754224876 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14908#pullrequestreview-5754224876). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T14:46:11Z. **Review:** APPROVED --- # Reviewed — approved `sceSaveDataGetSavePoint`, `sceSaveDataGetClientThreadPriority` and `sceSaveDataDebugGetThreadId` used to throw and now return 2, 0 and 0, as in the firmware 13.42 disassembly quoted in the description. The new test passes on the merged tree and fails when the production file is restored from `main`. The debt list is updated to match. ## What I ran Head `8f80305e9c4b7cdbbd073421b6fa0cd42741540a` merged with `--no-ff` into `main` `4f41f4c375f5abb487dbd184fbc150f31994d762` (merged tree `431e9988e4b3e2bccb41f8353efa6c2c9ef45edf`). Machine: Debian 13 VM, 32 vCPU (Xeon Gold 6136), GCC 14.2.0, Release, Ninja, `BUILD_TESTING=ON`. ``` git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...8f80305e9c4b7cdbbd073421b6fa0cd42741540a python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ctest --test-dir build --output-on-failure -R "guest_savedata|public_headers" -j8 --test-load 32 # negative control git show 4f41f4c375f5abb487dbd184fbc150f31994d762:core/libs/prx/libSceSaveData.native/Export.cpp > core/libs/prx/libSceSaveData.native/Export.cpp ninja -C build -j32 -l32 guest_savedata_constant_calls_tests ctest --test-dir build --output-on-failure -R "^guest_savedata_constant_calls$" git show 431e9988e4b3e2bccb41f8353efa6c2c9ef45edf:core/libs/prx/libSceSaveData.native/Export.cpp > core/libs/prx/libSceSaveData.native/Export.cpp ninja -C build -j32 -l32 guest_savedata_constant_calls_tests libSceSaveData.native ctest --test-dir build -R "^guest_savedata_constant_calls$" git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | 0 errors, 1 `debt-length` warning on the pending-declarations entry (4972 characters; it was already over the limit on `main` and this PR makes it shorter) | | Configure / build / `libs` (script) | ok | | Selected tests (script) | 2456 ran; no new failures, no timeouts. Known failures on `main`: `guest_interfaces`, `guest_socket_options_multicast`, `unwrap_self_..._destination_directory_group`, `vector_constant_factor_tininess`. The unexpected `guest_net_ctl` skip also happens on `main`. | | `guest_savedata_*` (11 tests, including the new `guest_savedata_constant_calls`) + `public_headers*` | 75/75 passed | | Validation-layer comparison | not applicable: no AGC, shader or VideoOut files changed | <details><summary>check_conventions.py</summary> ``` docs/dev/debt/libSceSaveData.native.md:26: warning: [debt-length] Technical debt entry over 1000 characters: ... 4972 characters 1 findings, 0 errors ``` </details> ## Negative control I restored only `core/libs/prx/libSceSaveData.native/Export.cpp` from `main` and rebuilt. `guest_savedata_constant_calls` then aborted: <details><summary>output</summary> ``` terminate called after throwing an instance of 'std::runtime_error' what(): sceSaveDataGetSavePoint not implemented 0% tests passed, 1 tests failed out of 1 3041 - guest_savedata_constant_calls (Subprocess aborted) ``` </details> After I restored the merged file and rebuilt, the test passed again, and `git status --porcelain` came back empty. ## Findings ### Blocking None. ### Non-blocking - `core/libs/prx/libSceSaveData.native/CMakeLists.txt:39`: the new test is the only SaveData test that sets its own `TIMEOUT 20`, and it does not call `configure_windows_unwind` like the tests next to it. Neither is needed for a test that runs in 0.01 s and catches no exceptions. Dropping the timeout would keep the registration consistent with the others. - `docs/dev/debt/libSceSaveData.native.md:27`: the new entry leaves out the `(libSceSaveData.native)` tag that the entries around it carry. It is cosmetic. ## Not verified - The firmware 13.42 disassembly and the native run in the description. I have no firmware module here, so the constants 2/0/0 and the claim that no argument or memory is read are taken from the description. The new test checks what the code does, not what the firmware does. - Windows behaviour. Linux GCC only. - No console measurement, as the description and the debt entry already state. <!-- anyps5-bots job=2190 head=8f80305e9c4b7cdbbd073421b6fa0cd42741540a -->
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!14908
No description provided.