fix(libSceSaveData): keep sceSaveDataGetMountedSaveDataCount unimplemented #14150

Merged
rooklz merged 2 commits from upstream-pr/14150 into main 2026-11-06 16:12:37 +00:00
rooklz commented 2026-10-31 20:56:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-31T20:56:44Z.


What

Keep sceSaveDataGetMountedSaveDataCount unimplemented: every call throws NotImplemented_nid_no_patch(__func__) and reads neither argument, as the export does on main. The console contract is unmeasured — the first argument's meaning, the count it returns, its error ordering and its null handling. SharpEmu and RPS5E both write the count through the second argument, so the declaration records that two-argument shape; neither establishes the first argument, and both return invented success rather than the console's behaviour. The debt entry states the gap.

core/libs/tests/GuestSaveDataMountStatus.cpp asserts that the call throws before initialization, after initialization, for a null count, and for a nonzero first argument, and that it writes no count.

Tested

  • python3 tools/check_conventions.py --base upstream/main: PASS
  • python3 tools/pr_overlap.py --branch feat/savedata-mounted-count-arg2: exit 0
  • Linux x86-64 container (Ubuntu 24.04, GCC 13.3, Release): guest_savedata_mount_status builds and passes with the four throw assertions
  • Not tested on a console; the count and error behaviour there remain unmeasured

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:5101461310 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14150). Originally posted by [rooklz](https://github.com/rooklz) on 2026-10-31T20:56:44Z. --- ### What Keep `sceSaveDataGetMountedSaveDataCount` unimplemented: every call throws `NotImplemented_nid_no_patch(__func__)` and reads neither argument, as the export does on `main`. The console contract is unmeasured — the first argument's meaning, the count it returns, its error ordering and its null handling. [SharpEmu](https://github.com/sharpemu/sharpemu/blob/b1ec2866575bf72ffcef92cd639c580bf5bf0c61/src/SharpEmu.Libs/SaveData/SaveDataExports.cs) and [RPS5E](https://github.com/keklick1337/rps5e/blob/d540c46f5d83efac3a0df9b2edc14cf12fe9f2be/crates/ps5hle/src/savedata.rs) both write the count through the second argument, so the declaration records that two-argument shape; neither establishes the first argument, and both return invented success rather than the console's behaviour. The debt entry states the gap. `core/libs/tests/GuestSaveDataMountStatus.cpp` asserts that the call throws before initialization, after initialization, for a null count, and for a nonzero first argument, and that it writes no count. ### Tested - `python3 tools/check_conventions.py --base upstream/main`: PASS - `python3 tools/pr_overlap.py --branch feat/savedata-mounted-count-arg2`: exit 0 - Linux x86-64 container (Ubuntu 24.04, GCC 13.3, Release): `guest_savedata_mount_status` builds and passes with the four throw assertions - Not tested on a console; the count and error behaviour there remain unmeasured ### 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 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
MarcZX10 commented 2026-10-31 20:58:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T20:58:32Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The implementation returns success while ignoring the first argument, whose PS5 meaning the PR explicitly says is unverified.

What I ran

Reviewed head 645cda522f5e82d255b34b4b79cc158ecb1155e4 against PR base 9fe758d7520eb0c33f3df8bef539064b40bd523f; the no-build merge preview against that base was clean. Environment: Debian Linux x86_64, Python 3.11.2, GCC 12.2.0. I inspected the implementation, declaration, added assertions, previous #13785 discussion, and the two cited implementations. I did not build or run C++ tests locally.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14150
python3 tools/check_conventions.py --base 9fe758d7520eb0c33f3df8bef539064b40bd523f --head 645cda522f5e82d255b34b4b79cc158ecb1155e4
python3 tools/pr_stack_check.py 14150 --repo boykopovar/AnyPS5

Results

Check Result
Diff check Passed.
Conventions and PR template Passed.
Current-base merge preview Clean against 9fe758d7520eb0c33f3df8bef539064b40bd523f.
Hosted eligibility and intake Passed on this head.
Hosted Windows, conventions, portability, labels, report Queued at the last refresh; Linux and specialized jobs were skipped.
ABI audit and test-quality helper Could not run: the isolated checkout does not contain the workspace-only scripts pr_abi_audit.py and pr_test_quality.py.
Local build and C++ tests Not run.
Unedited local check output
All conventions checks passed.

Findings

Blocking

  • The first argument's behavior remains unknown. The implementation declares it as std::int32_t reserved, ignores every value, and returns SAVE_DATA_OK; the PR's own debt entry says its meaning is unverified. SharpEmu and RPS5E support reading the count from the second argument, but their implementations do not establish the PS5 contract for the first argument. Repository guidance requires unknown export behavior to remain explicitly unimplemented rather than returning invented success. Please keep this export throwing until the first argument's role and the success/error behavior are supported by authoritative evidence or a console measurement. If evidence establishes that the first argument is ignored, update the debt entry and add a regression covering representative nonzero values.

Non-blocking

None identified from the inspected source.

Sources

Not verified

I did not run a non-relinker build, guest_savedata_mount_status, or a console test. The new C++ assertions are not executed by the reported relinker-only CTest run. The hosted Windows job was queued at the last refresh.

To get this to a good state

Keep the export throwing until the first argument and return behavior are evidenced, or add authoritative/console evidence and tests that establish the full contract. I will rerun the same no-build checks on the new head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5724884513 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14150#pullrequestreview-5724884513). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T20:58:32Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The implementation returns success while ignoring the first argument, whose PS5 meaning the PR explicitly says is unverified. ## What I ran Reviewed head `645cda522f5e82d255b34b4b79cc158ecb1155e4` against PR base `9fe758d7520eb0c33f3df8bef539064b40bd523f`; the no-build merge preview against that base was clean. Environment: Debian Linux x86_64, Python 3.11.2, GCC 12.2.0. I inspected the implementation, declaration, added assertions, previous #13785 discussion, and the two cited implementations. I did not build or run C++ tests locally. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14150 python3 tools/check_conventions.py --base 9fe758d7520eb0c33f3df8bef539064b40bd523f --head 645cda522f5e82d255b34b4b79cc158ecb1155e4 python3 tools/pr_stack_check.py 14150 --repo boykopovar/AnyPS5 ``` ## Results | Check | Result | |---|---| | Diff check | Passed. | | Conventions and PR template | Passed. | | Current-base merge preview | Clean against `9fe758d7520eb0c33f3df8bef539064b40bd523f`. | | Hosted eligibility and intake | Passed on this head. | | Hosted Windows, conventions, portability, labels, report | Queued at the last refresh; Linux and specialized jobs were skipped. | | ABI audit and test-quality helper | Could not run: the isolated checkout does not contain the workspace-only scripts `pr_abi_audit.py` and `pr_test_quality.py`. | | Local build and C++ tests | Not run. | <details><summary>Unedited local check output</summary> ```text All conventions checks passed. ``` </details> ## Findings ### Blocking - **The first argument's behavior remains unknown.** The implementation declares it as `std::int32_t reserved`, ignores every value, and returns `SAVE_DATA_OK`; the PR's own debt entry says its meaning is unverified. SharpEmu and RPS5E support reading the count from the second argument, but their implementations do not establish the PS5 contract for the first argument. Repository guidance requires unknown export behavior to remain explicitly unimplemented rather than returning invented success. Please keep this export throwing until the first argument's role and the success/error behavior are supported by authoritative evidence or a console measurement. If evidence establishes that the first argument is ignored, update the debt entry and add a regression covering representative nonzero values. ### Non-blocking None identified from the inspected source. ## Sources - [Current implementation and first-argument declaration](https://github.com/boykopovar/AnyPS5/blob/645cda522f5e82d255b34b4b79cc158ecb1155e4/core/libs/prx/libSceSaveData.native/Export.cpp#L1305-L1321) - [PR debt entry marking first-argument meaning unverified](https://github.com/boykopovar/AnyPS5/blob/645cda522f5e82d255b34b4b79cc158ecb1155e4/docs/dev/debt/libSceSaveData.native.md) - [SharpEmu reads the count from RSI](https://github.com/sharpemu/sharpemu/blob/b1ec2866575bf72ffcef92cd639c580bf5bf0c61/src/SharpEmu.Libs/SaveData/SaveDataExports.cs#L598-L614) - [RPS5E reads the count from RSI](https://github.com/keklick1337/rps5e/blob/d540c46f5d83efac3a0df9b2edc14cf12fe9f2be/crates/ps5hle/src/savedata.rs#L1500-L1505) - [Repository rule for unknown export behavior](https://github.com/boykopovar/AnyPS5/blob/9fe758d7520eb0c33f3df8bef539064b40bd523f/AGENTS.md#L5-L5) ## Not verified I did not run a non-relinker build, `guest_savedata_mount_status`, or a console test. The new C++ assertions are not executed by the reported relinker-only CTest run. The hosted Windows job was queued at the last refresh. ## To get this to a good state Keep the export throwing until the first argument and return behavior are evidenced, or add authoritative/console evidence and tests that establish the full contract. I will rerun the same no-build checks on the new head.
MarcZX10 commented 2026-11-01 09:38:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T09:38:25Z.

Review: COMMENTED


Re-checked — new head, change request addressed; Windows pending

At ce8f3172d0 the export throws again and the test asserts the throw, which is the change requested on 645cda522f; the hosted Windows job at this head had not finished at review time.

What I ran

  • Exact head ce8f3172d0fcab657625bdf519594a707b3ddbd5 (one new commit after 645cda522f, the head of my change request), base 1bc97b9527eaf6b56681cd3465bca67b75329161.
  • Environment: Debian 12, Python 3.11.2, GCC 12.2.0. No build.
  • Diff of 645cda522f..ce8f3172d0 read in full: Export.cpp, GuestSaveDataMountStatus.cpp, CMakeLists.txt, and docs/dev/debt/libSceSaveData.native.md.
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14150
python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base 1bc97b9527eaf6b56681cd3465bca67b75329161 --head ce8f3172d0fcab657625bdf519594a707b3ddbd5 --json
python3 tools/pr_test_quality.py --root <git archive of ce8f3172d0> --json core/libs/tests/GuestSaveDataMountStatus.cpp

Results

Check Result
git diff --check Passed
Conventions and PR template Passed
Stack and mergeability Passed
ABI audit (by hand) Passed: 118 symbols, 0 findings
Test-quality heuristic (by hand) One possible-unregistered-cpp-test finding. False positive: GuestSaveDataMountStatus.cpp is registered in core/libs/prx/libSceSaveData.native/CMakeLists.txt at lines 35-38.
Hosted Windows at this head Queued at review time
Hosted Linux, relinker and specialized jobs Skipped by the workflow
Build and tests Not run

Findings

Blocking

None.

Resolved from my change request

  • The export is NotImplemented_nid_no_patch(__func__), which throws std::runtime_error (core/libs/prx/libc/src/General.cpp:1020-1023 at this head). The test's MountedCountThrows catches std::runtime_error, so the assertions match the throw. Every call site in the test is converted, including the nonzero first argument and the null count.
  • The debt entry now says every call throws and reads neither argument, so the unverified first-argument meaning is no longer presented as settled.
  • The Windows failure reported in the 09:17 comment (guest_savedata_mount_status with 0xc0000409) is handled by configure_windows_unwind(guest_savedata_mount_status_tests) at line 38. The author's claim that every sibling SaveData test target has the same call holds: lines 8, 18, 28, 38, 48, 58 and 68 each call it for their target.

Sources

Not verified

  • Hosted Windows result at ce8f3172d0: queued at review time. The guest_savedata_mount_status fix has not been confirmed on a Windows runner.
  • The new throw assertions (MountedCountThrows) were not executed here, and no negative control was run.
  • No build and no C++ test run on any host.

To get this to a good state

  • Wait for the Windows job at ce8f3172d0 to finish. If it passes, I will re-check and update the review decision on this head. The change request stays in place until then.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5727407308 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14150#pullrequestreview-5727407308). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T09:38:25Z. **Review:** COMMENTED --- # Re-checked — new head, change request addressed; Windows pending At `ce8f3172d0` the export throws again and the test asserts the throw, which is the change requested on `645cda522f`; the hosted Windows job at this head had not finished at review time. ## What I ran - Exact head `ce8f3172d0fcab657625bdf519594a707b3ddbd5` (one new commit after `645cda522f`, the head of my change request), base `1bc97b9527eaf6b56681cd3465bca67b75329161`. - Environment: Debian 12, Python 3.11.2, GCC 12.2.0. No build. - Diff of `645cda522f..ce8f3172d0` read in full: `Export.cpp`, `GuestSaveDataMountStatus.cpp`, `CMakeLists.txt`, and `docs/dev/debt/libSceSaveData.native.md`. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14150 python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base 1bc97b9527eaf6b56681cd3465bca67b75329161 --head ce8f3172d0fcab657625bdf519594a707b3ddbd5 --json python3 tools/pr_test_quality.py --root <git archive of ce8f3172d0> --json core/libs/tests/GuestSaveDataMountStatus.cpp ``` ## Results | Check | Result | |---|---| | `git diff --check` | Passed | | Conventions and PR template | Passed | | Stack and mergeability | Passed | | ABI audit (by hand) | Passed: 118 symbols, 0 findings | | Test-quality heuristic (by hand) | One `possible-unregistered-cpp-test` finding. False positive: `GuestSaveDataMountStatus.cpp` is registered in `core/libs/prx/libSceSaveData.native/CMakeLists.txt` at lines 35-38. | | Hosted Windows at this head | Queued at review time | | Hosted Linux, relinker and specialized jobs | Skipped by the workflow | | Build and tests | Not run | ## Findings ### Blocking None. ### Resolved from my change request - The export is `NotImplemented_nid_no_patch(__func__)`, which throws `std::runtime_error` (`core/libs/prx/libc/src/General.cpp:1020-1023` at this head). The test's `MountedCountThrows` catches `std::runtime_error`, so the assertions match the throw. Every call site in the test is converted, including the nonzero first argument and the null count. - The debt entry now says every call throws and reads neither argument, so the unverified first-argument meaning is no longer presented as settled. - The Windows failure reported in the 09:17 comment (`guest_savedata_mount_status` with `0xc0000409`) is handled by `configure_windows_unwind(guest_savedata_mount_status_tests)` at line 38. The author's claim that every sibling SaveData test target has the same call holds: lines 8, 18, 28, 38, 48, 58 and 68 each call it for their target. ## Sources - Export at the head: https://github.com/boykopovar/AnyPS5/blob/ce8f3172d0fcab657625bdf519594a707b3ddbd5/core/libs/prx/libSceSaveData.native/Export.cpp#L1305-L1311 - Throwing helper: https://github.com/boykopovar/AnyPS5/blob/ce8f3172d0fcab657625bdf519594a707b3ddbd5/core/libs/prx/libc/src/General.cpp#L1020-L1023 - CMake registration and Windows unwind on every SaveData test target: https://github.com/boykopovar/AnyPS5/blob/ce8f3172d0fcab657625bdf519594a707b3ddbd5/core/libs/prx/libSceSaveData.native/CMakeLists.txt#L35-L38 ## Not verified - Hosted Windows result at `ce8f3172d0`: queued at review time. The `guest_savedata_mount_status` fix has not been confirmed on a Windows runner. - The new throw assertions (`MountedCountThrows`) were not executed here, and no negative control was run. - No build and no C++ test run on any host. ## To get this to a good state - Wait for the Windows job at `ce8f3172d0` to finish. If it passes, I will re-check and update the review decision on this head. The change request stays in place until then.
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!14150
No description provided.