feat(libSceSaveData): implement sceSaveDataCheckBackupData, sceSaveDataRestoreBackupData and sceSaveDataUmountWithBackup #12748

Merged
EagleBearerYS merged 14 commits from upstream-pr/12748 into main 2026-11-02 22:35:51 +00:00
EagleBearerYS commented 2026-10-29 07:28:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-29T07:28:21Z.


What

The three were parameterless declarations that threw through NotImplemented_nid_no_patch. They now take shadPS4's signatures and do what its PS4 binding does, on this library's save store.

  • Sources (shadPS4 at ce74386283, fpPS4 at 04cefd43e6):
  • The check:
    • SAVE_DATA_ERROR_NOT_INITIALIZED before initialization;
    • PARAMETER for a null block or directory name;
    • BUSY while the save is mounted;
    • NOT_FOUND when there is no backup;
    • otherwise 0, with param filled from the backup.
  • The restore: the same checks, then the save's files, param and size are replaced with the backup's. INTERNAL when the save directory is missing, the backup's metadata is incomplete or the wrong size, or a file call fails.
    • The backup is first copied to _sd_restore_tmp/<dir name>, checked complete and flushed. The live save then moves to _sd_restore_old/<dir name> and the copy into place, and a failed move puts back what had moved, so a failed restore leaves the save as it was.
  • The unmount with backup:
    • NOT_INITIALIZED before initialization, and PARAMETER for a null mount point;
    • otherwise it unmounts, copies the save to its backup, and queues a type-1 event with the mount's user, the title and the directory for sceSaveDataGetEventResult;
    • a failed copy sets the event's error to INTERNAL, as shadPS4's backup thread does, and the call still returns 0.
  • Where it differs from shadPS4, each stated in libSceSaveData.native.md's debt entries:
    • an unknown mount point returns NOT_MOUNTED, as sceSaveDataUmount2 does here, where shadPS4 returns NOT_FOUND;
    • the copy finishes before the call returns, so BACKUP_BUSY never occurs and the event is queued at once, as in fpPS4;
    • another title's titleId returns NOT_FOUND, because only the running title's saves are kept;
    • saves keep no icons, so the check never fills icon. shadPS4 does the same when there's no icon0.png.
  • Where backups live: _sd_backup/<dir name>, outside the save, so the title's mount and its block count don't see them.
    • Each backup is built in _sd_backup_tmp, flushed, and swapped in through _sd_backup_old, like shadPS4's sce_backup_tmp and sce_backup_old. A failed swap puts the previous backup back.
    • Every root and entry a call copies or deletes must be a plain file or directory under its root: a symlink or a Windows reparse point gives INTERNAL with nothing changed.
    • sceSaveDataDelete removes a save's backup along with the save. In shadPS4 the backup lives inside the save directory that Delete removes.
  • Shared code:
    • mount3, deleteSave and convert each had their own copy of the directory-name check. They and the two new functions now call one helper, with the same rules.
    • MountSlot now keeps the mounting user, for the event.
  • Not measured on a PS5: the layouts and the error checks follow shadPS4's PS4 binding, and the tests check that binding, not the console. The debt entry says so. A PS4 Pro on firmware 10.71 agrees with every error code and result it was run for (see Tested). The one difference it found, PARAMETER for a param buffer that isn't zeroed, is a debt entry, since which bytes the console checks isn't known.
  • Not covered: sceSaveDataBackup doesn't copy yet, so the check and the restore see only backups that sceSaveDataUmountWithBackup made (also in the debt entry). Making it use the same copy is a follow-up.

Tested

  • guest_savedata_mount_status, 37 new checks:
    • before sceSaveDataInitialize3, all three calls return NOT_INITIALIZED;
    • PARAMETER for a null block or directory name, and for a null mount point;
    • NOT_FOUND for a save with no backup, and BUSY for a mounted one, from both the check and the restore;
    • sceSaveDataUmountWithBackup returns 0 and unmounts. sceSaveDataGetEventResult then gives type 1, error 0, user 7, title PPSA00000 and directory kept;
    • after that backup, the check fills param with the backed-up title, also when it is given the running title's ID;
    • after data.bin is changed, added.bin is added and the title is changed, the restore puts back data.bin, removes added.bin and puts back the title;
    • deleting the save makes the check return NOT_FOUND.
  • Red/green on Linux (Ubuntu 24.04, GCC 13.3, Release):
    • Red, main's library code with only the three signatures changed so it builds: the test aborts with sceSaveDataCheckBackupData not implemented.
    • Red, stubs that return 0: 24 of the 37 new checks fail. The 13 that pass are setup steps, calls that only need to return 0, and the event's zero error.
    • Red, without the backup removal in sceSaveDataDelete: only "deleting a save deletes its backup" fails.
    • Green: the 13 save-data tests (guest_savedata_*, savedata_*) ran 10 times: 130 passed, 0 skipped, 0 failed.
  • GitHub, ×10 on both runners (run): the 13 save-data tests pass 10 of 10 on Linux and on Windows, 0 skipped. The libc and libkernel suites run 171 and 291 tests on Linux and 199 and 314 on Windows, with 0 failed.
    • On the runners, main's code doesn't build the new cases, because its stubs take no parameters.
  • Checks on Linux: check_test_registration.py passes, and no comment lines are added.
    • check_conventions.py: one warning, the debt-length check on the pending list in libSceSaveData.native.md. That list is a single line and was already over the limit on main. This change removes three names from it, so it gets shorter, from 6,140 to 5,870 characters.
  • MinGW-w64 -fsyntax-only: Export.cpp and the test show no new diagnostics.
  • b17c475af5, six commits after oneandonlydean's review:
    • 26a50dd0fd validates the backup's metadata before the check and the restore read it;
    • 637b601bfb restores through a staged copy and rolls back a failed swap;
    • 1744dbf5ab puts the old backup back when the backup swap fails, and flushes before removing it;
    • 9429d8395b keeps save and backup paths inside their roots;
    • eff8683d05 adds the coverage cases;
    • b17c475af5 says in the debt entries how a failed restore or a crash leaves the save.
    • On Linux, each fix commit's new cases fail on its parent and pass with it. eff8683d05's cases already passed on the first head.
    • GitHub, ×10 on both runners (run): Linux 13 run, 13 pass, 0 skip, 0 fail; Windows 13 run, 13 pass, 0 skip, 0 fail. The libc and libkernel suites run 171 and 291 tests on Linux and 199 and 314 on Windows, with 0 failed. They ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
    • The link cases use symlinks on Linux, and on Windows a directory junction and a symbolic link. A verbose run (run, ctest -V, 2 runs) shows no case skipped on either runner, so the junction and reparse-point cases ran on Windows and the symlink cases on Linux.
  • A PS4 console run, by ntamas94 (comment): a PS4 Pro on firmware 10.71 with the system libSceSaveData.sprx (SDK 0x05050001), the shadPS4 structures and a zeroed 1,328-byte param. It agrees with this PR on every row it covers:
    • NOT_FOUND with no save or backup, for another title's id or another directory, and after sceSaveDataDelete, so the delete takes the backup with it;
    • BUSY while the save is mounted, before NOT_FOUND;
    • NOT_MOUNTED from sceSaveDataUmountWithBackup for a mount point that is no longer mounted;
    • the check sees the backup right after the unmount returns, and a restore brings the backed-up title back.
    • Not modelled: the check returns PARAMETER for a param filled with 0xAA, also with a backup present, and 0 for a zeroed or null one. Which bytes it checks wasn't measured, so bb346f7cad records it as a debt entry, with the delete and other-title rows, and the code is unchanged. The events weren't measured, and this is a PS4, not a PS5.
  • 22291cddd8, a merge of main 91a69952c1 (run). Four of the main changes it brings touch this PR's files: slopgobblercobbler's #12644, ionut27001's #11720, al3w0f205's #12220 and xXPBSXx's #12600.
    • The conflicts: two, both with #12644, which validates sceSaveDataBackup's directory name.
      • In GuestSaveDataMountStatus.cpp, #12644 adds its backup checks at the end of CheckUnmountedCalls, where this PR adds its three NOT_INITIALIZED checks. The merge keeps both: #12644's checks first, then this PR's.
      • In docs/dev/debt/libSceSaveData.native.md, #12644 adds an entry for sceSaveDataBackup's unterminated directory name where this PR adds its entries for the three backup calls. The merge keeps #12644's entry, then this PR's.
    • This PR's added and removed lines are unchanged.
    • check_conventions.py's debt-length warning on line 19 is main's pending-declarations entry: 6,140 characters on main, 5,870 here after this PR removes the three names it implements.
    • ×10: ^guest_savedata, 7 tests.
      • Linux: 7 run, 7 pass, 0 skip, 0 fail.
      • Windows: 7 run, 7 pass, 0 skip, 0 fail.
      • The libc and libkernel suites run 195 and 294 tests on Linux and 224 and 318 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 46c8ff27a6, a merge of main 8c8b998620 (run), which brings SnekPolylepis's #12699 (sceSaveDataAbort, sceSaveDataClearProgress and the mounted-save count).
    • The conflicts: three in GuestSaveDataMountStatus.cpp and one in docs/dev/debt/libSceSaveData.native.md, all with #12699. The merge keeps both sides:
      • the two error constants each side adds;
      • this PR's backup helpers and checks, then #12699's CheckMountCapacityAndLifecycle;
      • in main(), this PR's backup checks run before #12699's closing sceSaveDataTerminate checks;
      • the pending-declarations entry drops both sides' implemented names: this PR's three backup calls and #12699's sceSaveDataAbort, sceSaveDataClearProgress and sceSaveDataGetMountedSaveDataCount. 60 names remain.
    • #12699 adds the same SaveDataErrorNotInitialized constant this PR's test added, so that line is now main's. This PR's other added and removed lines are unchanged.
    • ×10: ^guest_savedata, 7 tests.
      • Linux: 7 run, 7 pass, 0 skip, 0 fail.
      • Windows: 7 run, 7 pass, 0 skip, 0 fail.
      • The libc and libkernel suites run 197 and 294 tests on Linux and 224 and 318 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 842f75d7e0, a merge of main 7fcab08f71, which brings JJenkx's #13324 (run).
    • The build: #13324 gives isMountedDirectory an std::error_code parameter, and this PR's two new calls, in checkBackupData and restoreBackupData, no longer compiled on main. The merge passes one, as main's callers do, so Check and Restore now return SAVE_DATA_ERROR_INTERNAL on a host filesystem error instead of throwing, consistent with #13324.
    • The test: CheckBackups now writes param.json at the resolved /app0 path, since #13324's test fixes the guest root in a subdirectory first.
    • This PR's own diff changes only at those two calls and those three test lines. There was no textual conflict.
    • ×10: ^guest_savedata_ and ^savedata_, guest_savedata_mount_status among them.
      • Linux: 13 run, 13 pass, 0 skip, 0 fail.
      • Windows: 14 run, 14 pass, 0 skip, 0 fail.
      • The libc and libkernel suites run 199 and 307 tests on Linux and 226 and 329 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 9b9e850d90, oneandonlydean's merge of main d8b60b46ed, which brings DealPotato's #8285 (sceSaveDataMount2) and the host free-space checks in mount3.
    • The conflict: only libSceSaveData.native/Export.cpp's include block, where #8285 adds <string_view> beside this PR's includes. Both are kept.
    • mount3, which both sides change, merged on its own and composes: main reads the free-space mode first and refuses a new save the host volume can't hold, and this PR's parse_dir_name and the slot's user_id stay. #8285's mount2 passes user_id through to it.
    • ×10 on the same tree (run): the eight guest_savedata_* tests, main's and this PR's. Linux: 8 run, 8 pass, 0 skip, 0 fail. Windows: 8 run, 8 pass, 0 skip, 0 fail. The libc and libkernel suites run 208 and 309 tests on Linux and 235 and 330 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 23493d9ca3, oneandonlydean's merge of main 24238c4cb1. The one conflict was the pending-declarations list in docs/dev/debt/libSceSaveData.native.md: MarcZX10's #10674 moves sceSaveDataGetProgress out of it into its own entry, and the merge keeps that with this PR's removal of its three calls. This PR's diff over main is unchanged. On GitHub's runners (run, on 5a7a8f34dc, a merge of main 3c3b3cda73 with the same resolution; main's later commits change only a cmake line and two debt files outside this PR), the ^guest_save tests with guest_savedata_mount_status ran 10 times with no failure. Linux: 8 run, 8 pass, 0 skip, 0 fail. Windows: 8 run, 8 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (214 and 316) and on Windows (241 and 337). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 02af078a35, oneandonlydean's merge of main b28bb77217. The one conflicting file was docs/dev/debt/libSceSaveData.native.md. The merge keeps main's sceSaveDataGetProgress entry, which xecedemon's #15077 extends, and the unterminated-mount-point sentence that slopgobblercobbler's #12853 adds to the null-pointer entry, with this PR's removal of its three calls and its new entries. #12853 and slopgobblercobbler's #12846 change libSceSaveData.native/Export.cpp too, and those merged without conflicts.
    • This PR's changed lines over main are identical to those in 3547c39f11, our merge of main f06d7fdcee, which ran ×10 on GitHub's runners (run): the ^guest_save tests with guest_savedata_mount_status. Linux: 8 run, 8 pass, 0 skip, 0 fail. Windows: 8 run, 8 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (217 and 318) and on Windows (244 and 339). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
    • On 02af078a35 itself, #13551, which is stacked on this PR, ran its nine guest_savedata_* tests 10 times with no failure on both runners (run).

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; #10674 has merged, and the merge of main keeps both sets of removals and its new entry. Any order with fogydes's #15042, for merge order only: in convert in libSceSaveData.native/Export.cpp, #15042 checks its own copy of the directory name and this PR reads param->dir_name through parse_dir_name. Whichever lands second runs parse_dir_name on #15042's copy.
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5064083756 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12748). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-29T07:28:21Z. --- ### What The three were parameterless declarations that threw through `NotImplemented_nid_no_patch`. They now take shadPS4's signatures and do what its PS4 binding does, on this library's save store. - **Sources** (shadPS4 at ce74386283, fpPS4 at 04cefd43e6): - [`sceSaveDataCheckBackupData`](https://github.com/shadps4-emu/shadPS4/blob/ce74386283f559f2279a7c31416bcdc9359be0b3/src/core/libraries/save_data/savedata.cpp#L615-L664), with its block [layout](https://github.com/shadps4-emu/shadPS4/blob/ce74386283f559f2279a7c31416bcdc9359be0b3/src/core/libraries/save_data/savedata.cpp#L110-L118); - [`sceSaveDataRestoreBackupData`](https://github.com/shadps4-emu/shadPS4/blob/ce74386283f559f2279a7c31416bcdc9359be0b3/src/core/libraries/save_data/savedata.cpp#L1360-L1398) and its [`Restore`](https://github.com/shadps4-emu/shadPS4/blob/ce74386283f559f2279a7c31416bcdc9359be0b3/src/core/libraries/save_data/save_backup.cpp#L258-L277), with its block [layout](https://github.com/shadps4-emu/shadPS4/blob/ce74386283f559f2279a7c31416bcdc9359be0b3/src/core/libraries/save_data/savedata.cpp#L249-L258); - [`sceSaveDataUmountWithBackup`](https://github.com/shadps4-emu/shadPS4/blob/ce74386283f559f2279a7c31416bcdc9359be0b3/src/core/libraries/save_data/savedata.cpp#L1758-L1761), which is [`Umount`](https://github.com/shadps4-emu/shadPS4/blob/ce74386283f559f2279a7c31416bcdc9359be0b3/src/core/libraries/save_data/savedata.cpp#L512-L543) followed by a [backup](https://github.com/shadps4-emu/shadPS4/blob/ce74386283f559f2279a7c31416bcdc9359be0b3/src/core/libraries/save_data/save_backup.cpp#L93-L134) and a `UMOUNT_BACKUP` event. fpPS4's [version](https://github.com/red-prig/fpPS4/blob/04cefd43e6fddd1ab033e7980cd356d14c964905/src/ps4_libscesavedata.pas#L444-L462) unmounts and posts the event. - **The check:** - `SAVE_DATA_ERROR_NOT_INITIALIZED` before initialization; - `PARAMETER` for a null block or directory name; - `BUSY` while the save is mounted; - `NOT_FOUND` when there is no backup; - otherwise 0, with `param` filled from the backup. - **The restore:** the same checks, then the save's files, param and size are replaced with the backup's. `INTERNAL` when the save directory is missing, the backup's metadata is incomplete or the wrong size, or a file call fails. - The backup is first copied to `_sd_restore_tmp/<dir name>`, checked complete and flushed. The live save then moves to `_sd_restore_old/<dir name>` and the copy into place, and a failed move puts back what had moved, so a failed restore leaves the save as it was. - **The unmount with backup:** - `NOT_INITIALIZED` before initialization, and `PARAMETER` for a null mount point; - otherwise it unmounts, copies the save to its backup, and queues a type-1 event with the mount's user, the title and the directory for `sceSaveDataGetEventResult`; - a failed copy sets the event's error to `INTERNAL`, as shadPS4's [backup thread](https://github.com/shadps4-emu/shadPS4/blob/ce74386283f559f2279a7c31416bcdc9359be0b3/src/core/libraries/save_data/save_backup.cpp#L167-L173) does, and the call still returns 0. - **Where it differs from shadPS4**, each stated in `libSceSaveData.native.md`'s debt entries: - an unknown mount point returns `NOT_MOUNTED`, as `sceSaveDataUmount2` does here, where shadPS4 returns `NOT_FOUND`; - the copy finishes before the call returns, so `BACKUP_BUSY` never occurs and the event is queued at once, as in fpPS4; - another title's `titleId` returns `NOT_FOUND`, because only the running title's saves are kept; - saves keep no icons, so the check never fills `icon`. shadPS4 does the same when there's no `icon0.png`. - **Where backups live:** `_sd_backup/<dir name>`, outside the save, so the title's mount and its block count don't see them. - Each backup is built in `_sd_backup_tmp`, flushed, and swapped in through `_sd_backup_old`, like shadPS4's `sce_backup_tmp` and `sce_backup_old`. A failed swap puts the previous backup back. - Every root and entry a call copies or deletes must be a plain file or directory under its root: a symlink or a Windows reparse point gives `INTERNAL` with nothing changed. - `sceSaveDataDelete` removes a save's backup along with the save. In shadPS4 the backup lives inside the save directory that Delete removes. - **Shared code:** - `mount3`, `deleteSave` and `convert` each had their own copy of the directory-name check. They and the two new functions now call one helper, with the same rules. - `MountSlot` now keeps the mounting user, for the event. - **Not measured on a PS5:** the layouts and the error checks follow shadPS4's PS4 binding, and the tests check that binding, not the console. The debt entry says so. A PS4 Pro on firmware 10.71 agrees with every error code and result it was run for (see Tested). The one difference it found, `PARAMETER` for a `param` buffer that isn't zeroed, is a debt entry, since which bytes the console checks isn't known. - **Not covered:** `sceSaveDataBackup` doesn't copy yet, so the check and the restore see only backups that `sceSaveDataUmountWithBackup` made (also in the debt entry). Making it use the same copy is a follow-up. ### Tested - **`guest_savedata_mount_status`, 37 new checks:** - before `sceSaveDataInitialize3`, all three calls return `NOT_INITIALIZED`; - `PARAMETER` for a null block or directory name, and for a null mount point; - `NOT_FOUND` for a save with no backup, and `BUSY` for a mounted one, from both the check and the restore; - `sceSaveDataUmountWithBackup` returns 0 and unmounts. `sceSaveDataGetEventResult` then gives type 1, error 0, user 7, title `PPSA00000` and directory `kept`; - after that backup, the check fills `param` with the backed-up title, also when it is given the running title's ID; - after `data.bin` is changed, `added.bin` is added and the title is changed, the restore puts back `data.bin`, removes `added.bin` and puts back the title; - deleting the save makes the check return `NOT_FOUND`. - **Red/green on Linux** (Ubuntu 24.04, GCC 13.3, Release): - **Red, `main`'s library code** with only the three signatures changed so it builds: the test aborts with `sceSaveDataCheckBackupData not implemented`. - **Red, stubs that return 0:** 24 of the 37 new checks fail. The 13 that pass are setup steps, calls that only need to return 0, and the event's zero error. - **Red, without the backup removal in `sceSaveDataDelete`:** only "deleting a save deletes its backup" fails. - **Green:** the 13 save-data tests (`guest_savedata_*`, `savedata_*`) ran 10 times: 130 passed, 0 skipped, 0 failed. - **GitHub, ×10 on both runners** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40827965359)): the 13 save-data tests pass 10 of 10 on Linux and on Windows, 0 skipped. The libc and libkernel suites run 171 and 291 tests on Linux and 199 and 314 on Windows, with 0 failed. - On the runners, `main`'s code doesn't build the new cases, because its stubs take no parameters. - **Checks on Linux:** `check_test_registration.py` passes, and no comment lines are added. - **`check_conventions.py`:** one warning, the debt-length check on the pending list in `libSceSaveData.native.md`. That list is a single line and was already over the limit on `main`. This change removes three names from it, so it gets shorter, from 6,140 to 5,870 characters. - **MinGW-w64 `-fsyntax-only`:** `Export.cpp` and the test show no new diagnostics. - **b17c475af5, six commits after [oneandonlydean's review](https://github.com/boykopovar/AnyPS5/pull/12748#issuecomment-6493439051):** - 26a50dd0fd validates the backup's metadata before the check and the restore read it; - 637b601bfb restores through a staged copy and rolls back a failed swap; - 1744dbf5ab puts the old backup back when the backup swap fails, and flushes before removing it; - 9429d8395b keeps save and backup paths inside their roots; - eff8683d05 adds the coverage cases; - b17c475af5 says in the debt entries how a failed restore or a crash leaves the save. - On Linux, each fix commit's new cases fail on its parent and pass with it. eff8683d05's cases already passed on the first head. - **GitHub, ×10 on both runners** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40862514210)): Linux 13 run, 13 pass, 0 skip, 0 fail; Windows 13 run, 13 pass, 0 skip, 0 fail. The libc and libkernel suites run 171 and 291 tests on Linux and 199 and 314 on Windows, with 0 failed. They ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **The link cases** use symlinks on Linux, and on Windows a directory junction and a symbolic link. A verbose run ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40880706663), `ctest -V`, 2 runs) shows no case skipped on either runner, so the junction and reparse-point cases ran on Windows and the symlink cases on Linux. - **A PS4 console run, by ntamas94** ([comment](https://github.com/boykopovar/AnyPS5/pull/12748#issuecomment-6499581390)): a PS4 Pro on firmware 10.71 with the system `libSceSaveData.sprx` (SDK 0x05050001), the shadPS4 structures and a zeroed 1,328-byte `param`. It agrees with this PR on every row it covers: - `NOT_FOUND` with no save or backup, for another title's id or another directory, and after `sceSaveDataDelete`, so the delete takes the backup with it; - `BUSY` while the save is mounted, before `NOT_FOUND`; - `NOT_MOUNTED` from `sceSaveDataUmountWithBackup` for a mount point that is no longer mounted; - the check sees the backup right after the unmount returns, and a restore brings the backed-up title back. - **Not modelled:** the check returns `PARAMETER` for a `param` filled with 0xAA, also with a backup present, and 0 for a zeroed or null one. Which bytes it checks wasn't measured, so bb346f7cad records it as a debt entry, with the delete and other-title rows, and the code is unchanged. The events weren't measured, and this is a PS4, not a PS5. - **22291cddd8, a merge of `main` 91a69952c1** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40989208417)). Four of the `main` changes it brings touch this PR's files: slopgobblercobbler's #12644, ionut27001's #11720, al3w0f205's #12220 and xXPBSXx's #12600. - **The conflicts:** two, both with #12644, which validates `sceSaveDataBackup`'s directory name. - In `GuestSaveDataMountStatus.cpp`, #12644 adds its backup checks at the end of `CheckUnmountedCalls`, where this PR adds its three `NOT_INITIALIZED` checks. The merge keeps both: #12644's checks first, then this PR's. - In `docs/dev/debt/libSceSaveData.native.md`, #12644 adds an entry for `sceSaveDataBackup`'s unterminated directory name where this PR adds its entries for the three backup calls. The merge keeps #12644's entry, then this PR's. - This PR's added and removed lines are unchanged. - `check_conventions.py`'s `debt-length` warning on line 19 is `main`'s pending-declarations entry: 6,140 characters on `main`, 5,870 here after this PR removes the three names it implements. - **×10:** `^guest_savedata`, 7 tests. - Linux: 7 run, 7 pass, 0 skip, 0 fail. - Windows: 7 run, 7 pass, 0 skip, 0 fail. - The libc and libkernel suites run 195 and 294 tests on Linux and 224 and 318 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **46c8ff27a6, a merge of `main` 8c8b998620** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41006830778)), which brings SnekPolylepis's #12699 (`sceSaveDataAbort`, `sceSaveDataClearProgress` and the mounted-save count). - **The conflicts:** three in `GuestSaveDataMountStatus.cpp` and one in `docs/dev/debt/libSceSaveData.native.md`, all with #12699. The merge keeps both sides: - the two error constants each side adds; - this PR's backup helpers and checks, then #12699's `CheckMountCapacityAndLifecycle`; - in `main()`, this PR's backup checks run before #12699's closing `sceSaveDataTerminate` checks; - the pending-declarations entry drops both sides' implemented names: this PR's three backup calls and #12699's `sceSaveDataAbort`, `sceSaveDataClearProgress` and `sceSaveDataGetMountedSaveDataCount`. 60 names remain. - #12699 adds the same `SaveDataErrorNotInitialized` constant this PR's test added, so that line is now `main`'s. This PR's other added and removed lines are unchanged. - **×10:** `^guest_savedata`, 7 tests. - Linux: 7 run, 7 pass, 0 skip, 0 fail. - Windows: 7 run, 7 pass, 0 skip, 0 fail. - The libc and libkernel suites run 197 and 294 tests on Linux and 224 and 318 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **842f75d7e0, a merge of `main` 7fcab08f71**, which brings JJenkx's #13324 ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41142765137)). - **The build:** #13324 gives `isMountedDirectory` an `std::error_code` parameter, and this PR's two new calls, in `checkBackupData` and `restoreBackupData`, no longer compiled on `main`. The merge passes one, as `main`'s callers do, so Check and Restore now return `SAVE_DATA_ERROR_INTERNAL` on a host filesystem error instead of throwing, consistent with #13324. - **The test:** `CheckBackups` now writes param.json at the resolved `/app0` path, since #13324's test fixes the guest root in a subdirectory first. - **This PR's own diff** changes only at those two calls and those three test lines. There was no textual conflict. - **×10:** `^guest_savedata_` and `^savedata_`, `guest_savedata_mount_status` among them. - Linux: 13 run, 13 pass, 0 skip, 0 fail. - Windows: 14 run, 14 pass, 0 skip, 0 fail. - The libc and libkernel suites run 199 and 307 tests on Linux and 226 and 329 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **9b9e850d90, oneandonlydean's merge of `main` d8b60b46ed**, which brings DealPotato's #8285 (`sceSaveDataMount2`) and the host free-space checks in `mount3`. - **The conflict:** only `libSceSaveData.native/Export.cpp`'s include block, where #8285 adds `<string_view>` beside this PR's includes. Both are kept. - **`mount3`,** which both sides change, merged on its own and composes: `main` reads the free-space mode first and refuses a new save the host volume can't hold, and this PR's `parse_dir_name` and the slot's `user_id` stay. #8285's `mount2` passes `user_id` through to it. - **×10 on the same tree** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41316291855)): the eight `guest_savedata_*` tests, `main`'s and this PR's. Linux: 8 run, 8 pass, 0 skip, 0 fail. Windows: 8 run, 8 pass, 0 skip, 0 fail. The libc and libkernel suites run 208 and 309 tests on Linux and 235 and 330 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **23493d9ca3, oneandonlydean's merge of `main` 24238c4cb1.** The one conflict was the pending-declarations list in `docs/dev/debt/libSceSaveData.native.md`: MarcZX10's #10674 moves `sceSaveDataGetProgress` out of it into its own entry, and the merge keeps that with this PR's removal of its three calls. This PR's diff over `main` is unchanged. On GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41434123496), on 5a7a8f34dc, a merge of `main` 3c3b3cda73 with the same resolution; `main`'s later commits change only a cmake line and two debt files outside this PR), the `^guest_save` tests with `guest_savedata_mount_status` ran 10 times with no failure. Linux: 8 run, 8 pass, 0 skip, 0 fail. Windows: 8 run, 8 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (214 and 316) and on Windows (241 and 337). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **02af078a35, oneandonlydean's merge of `main` b28bb77217.** The one conflicting file was `docs/dev/debt/libSceSaveData.native.md`. The merge keeps `main`'s `sceSaveDataGetProgress` entry, which xecedemon's #15077 extends, and the unterminated-mount-point sentence that slopgobblercobbler's #12853 adds to the null-pointer entry, with this PR's removal of its three calls and its new entries. #12853 and slopgobblercobbler's #12846 change `libSceSaveData.native/Export.cpp` too, and those merged without conflicts. - **This PR's changed lines over `main` are identical** to those in 3547c39f11, our merge of `main` f06d7fdcee, which ran ×10 on GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41471821662)): the `^guest_save` tests with `guest_savedata_mount_status`. Linux: 8 run, 8 pass, 0 skip, 0 fail. Windows: 8 run, 8 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (217 and 318) and on Windows (244 and 339). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **On 02af078a35 itself,** #13551, which is stacked on this PR, ran its nine `guest_savedata_*` tests 10 times with no failure on both runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41482579712)). ### 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; #10674 has merged, and the merge of `main` keeps both sets of removals and its new entry. Any order with fogydes's #15042, for merge order only: in `convert` in `libSceSaveData.native/Export.cpp`, #15042 checks its own copy of the directory name and this PR reads `param->dir_name` through `parse_dir_name`. Whichever lands second runs `parse_dir_name` on #15042's copy. - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
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!12748
No description provided.