fix(savedata): leave the mount result untouched when sceSaveDataMount3 fails #4876
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4876"
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 EagleBearerYS on 2026-10-13T01:21:29Z.
What
Animal Well (PPSA22520, content 01.000.011) saves its progress outside its save directory, and a save placed in the save directory is never loaded.
sceSaveDataMount3cleared the caller's result before its checks, and the title depends on the result surviving a failed mount:SAVEDATA(CREATE2),stats<mount point>/saveand never unmounts.SAVEDATAagain into the same global result. They ignore every error except NO_SPACE (0x809F000A) and use the result's mount point forsceSaveDataPrepare,open("<mount point>/save", O_RDWR | O_CREAT ...)and the finalsceSaveDataUmount2.main, that second mount returns BUSY with the mount point cleared. The title then opens/save(the game folder) and callssceSaveDataUmount2with an empty mount point (NOT_MOUNTED), so the first mount is never released:The result is now cleared and written only when the mount succeeds, as shadPS4's
saveDataMountdoes (it returns BUSY for an already mounted directory before writingmount_result). Every error return (BUSY, EXISTS, NOT_FOUND, MOUNT_FULL) leaves it as it was. The title ships with this save flow and saves on the console, so the console'ssceSaveDataMount3evidently leaves the mount point in place on BUSY as well. A technical debt entry records that this follows shadPS4 and the title, not a hardware run.Tested
main43e3a70f8:guest_savedata_mount_status. The new check mounts a save, mounts it again into the same result (BUSY, result unchanged), opens a missing save into it (NOT_FOUND, result unchanged), then unmounts through the kept mount point.main'sExport.cppthe three new checks fail.main43e3a70f8): withmain'sExport.cppthe same three checks fail; with the change, 20/20 pass.main43e3a70f8with #4859 (the title needs it to boot), #4693 and #4410, with the save in_sd/SAVEDATA/save:savein the game folder and shows the new-game slot select._sd/SAVEDATA/save(mount3 ... -> 0x00000000 point=/savedata0,umount2 point=/savedata0 -> 0x00000000). Nothing is written to the game folder.main495bf91a0, which now has #4859, with nothing else applied: without this change the trace showsmount3 ... mode=0x20 -> 0x809f0003 point=andumount2 mode=0x0 point= -> 0x809f0004, the title opens/save(creating an emptysavein the game folder) and the slot select shows; with it, the title opens/savedata0/save, Continue loads the save, saving rewrites_sd/SAVEDATA/save, and every successful mount is unmounted.python3 tools/check_conventions.py --base origin/main: passed.mount3(at its end):Export.cppmerges cleanly with it.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)Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T11:51:45Z.
Windows test: head
4ccf88829merged onto currentmain5d50886ee, together with 9 other open pull requests in one build (the merges were conflict-free); a failure would have been bisected per PR. Windows 10, MinGW GCC (WinLibs), Ninja Release,-j2: full build 0 errors; ctest for the tests this change adds or touches: guest_savedata_mount_status passed;python tools/check_conventions.py --base upstream/mainpassed for the combined tree. I did not run the new tests againstmainwithout the change.AI-assisted (Claude Code).