feat(savedata): add sceSaveDataMount2 #8285
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8285"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by DealPotato on 2026-10-20T08:37:48Z.
What
Adds
sceSaveDataMount2, the save-data mount PS4 titles built with SDK 2.00 and later call. ItsSceSaveDataMount2isSceSaveDataMount3without the system blocks and the resource field (user ID, directory name, blocks, mount mode), so the function converts the parameters and mounts throughsceSaveDataMount3.Before that it answers the cases where a PS4 Pro (firmware 10.71) answered differently from Mount3, as @ntamas94 measured on this PR:
SAVE_DATA_ERROR_NOT_INITIALIZEDbeforesceSaveDataInitialize3;SAVE_DATA_ERROR_INVALID_LOGIN_USERfor user IDs -1 and 0;SAVE_DATA_ERROR_PARAMETERfor mount mode 0, for a directory name with_, and for creating a save of fewer than 96 blocks. The block minimum applies to CREATE only, because CREATE2 was not measured.A null mount or result is
SAVE_DATA_ERROR_PARAMETER, as main'ssceSaveDataMountanswers it. Otherwise the result, the mount point and the error codes are Mount3's. A lowercase directory name is accepted, because a retail title mounts one (inFAMOUS Second Son mountsinfamousssAuto0).SaveDataMount2inSceTypes.hpphas the PS4 layout (64 bytes;dir_nameat 8,blocksat 16,mount_modeat 24), which the test asserts. ThesceSaveDataMount2entry indocs/dev/debt/libSceSaveData.native.mdnotes that these are PS4 rows, not measured on a PS5.Tested
Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0 (MinGW-w64), Release, on this branch merged with
main5b8ba7b929:ctest -R "savedata|save_data|guest_kernel_error|public_headers": 79 of 79 pass.guest_savedata_ps4covers thesesceSaveDataMount2cases:sceSaveDataUmount2;core/libs/tests/test_public_headers.py --audit-only: passes.tools/check_conventions.py: all checks pass.inFAMOUS Second Son (CUSA00004, my own dump) calls it to open its saves. On a local stack of
mainwith the open PS4 PRs, the title mounts its save, loads it and reaches the open world.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-24T15:40:58Z.
Review: COMMENTED
Checked against main
b607bfdc8b, #7780's file list at797e2b97, and ntamas94's PS4 rows above:core/libs/CMakeLists.txt(newguest_np_cpp_web_api_signed_out_testsnext to the removed core test block) andcore/libs/tests/GuestSaveDataPs4.cpp(#9433'sTestSaveDataMemoryV1/TestMountPs4). Main also exportssceSaveDataUmountnow, so after the #7780 hold the unmount-dependent PS4 rows could be compared too.savedata_core_write_replacementregistration: it comes from #7780. As far as I can tell, coverage of the remaining code is kept: the test file is unchanged on main, the native variant keeps the same assertions, and the removed variant only coveredSaveDataCore.hpp, which is deleted. Every export from main's corelibSceSaveData/libSceSaveDataDialogexists in the native sources plus this PR; the only thing no longer exercised is linking thelibSceSaveDatatarget itself.mount2only usesmount3,g_initializationsand error constants already on main, so most of this diff (the CMake restructure, the core deletion, the pending declarations) is #7780's. It would be easier to review as just the Mount2 commit on top of #7780 once that settles.survey_testandSURVEY_TESTfor the underscore (0x809f0000). On this branch, mount3 only rejects/\:and./..(Export.cpp:623), sosceSaveDataMount2with "survey_test" still returns 0 and creates the directory. Could Mount2 reject_, or could this go in debt?user_idis passed through unchecked.mount2applies it to CREATE2 as well (Export.cpp:674-675). With an existing save, mode 0x22 and blocks 0, this now returns PARAMETER where mount3 would open the save. Could the check be limited to CREATE until CREATE2 is measured, or noted in debt?sceSaveDataMount2entry indocs/dev/debt/libSceSaveData.native.md. The three items above, and the fact that these checks are PS4 rows not measured on a PS5, would fit there.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.