fix(libSceSaveData.native): report a directory's own block count and free blocks #5173
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5173"
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 Mouad-Scriptz-0 on 2026-10-13T13:50:57Z.
What
sceSaveDataGetMountInfoandsceSaveDataDirNameSearchreported every directory as 32768 blocks with 32768 free. A mount that creates a directory now records the block count it asked for in a.blocksfile next to the directory's.paramfile, and both calls report that count with the free blocks reduced by the directory's files in 32 KiB blocks.sceSaveDataDeleteremoves the record with the directory. A directory with no record (made before this change, or by hand) reports its files rounded up to the 96-block minimum as its allocation; opening one does not record the opening mount's count, which is not the creation size.Minecraft (PPSA17221) sums the allocations of its save directories (the search's
blocks, taken as 64 KiB each) against a 9 GiB budget and sets its low-storage state when less than 100 MiB is left (full below 10 MiB): five directories at the 32768-block maximum summed to 10 GiB, so it showed "You are almost out of data storage space" and refused to open or create worlds (read out of the title with gdb: used 10 GiB, total 9 GiB, available 0). With the recorded sizes (80 blocks for its settings, 1535 for its level cache) the sum is a few hundred blocks, worlds open and create, and the world list shows a world's real size (1.4 MB where it showed 0.01 MB).Tested
Fedora 44 (kernel 7.2.8, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON), worktree onmain5d50886ee: newguest_savedata_blocks(a created directory reports its requested blocks, free blocks drop with files rounded up to 32 KiB blocks, the search agrees with the mount info, reopening with another count keeps the created size, delete removes the record, opening a directory without a record records nothing); a directory without a record reports its files rounded up to the minimum and grows with them;guest_savedata_searchandguest_savedata_deletestill pass;tools/check_conventions.py --base origin/mainandgit diff --checkpass. Minecraft: worlds open and create again, and the world list shows a world's real size (1.4 MB where it showed 0.01 MB); the dialog stayed away through a play session. Not tested on Windows.Checklist
docs/dev/CONVENTIONS.md🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-13T14:46:30Z.
Windows run, since the description says Windows is untested. Setup: Windows 11 (26300), WinLibs GCC 15.2.0 r7, Python 3.12, Git for Windows, Release,
BUILD_TESTING=ON,ctest -j4 --timeout 300, RTX 4080. Heade8d947d31merged intomain69b4ca5d9.guest_savedata_blocks,guest_savedata_searchandguest_savedata_deletepass.Not tested: a negative control on Windows, and a title.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by Zenodeon on 2026-10-14T08:20:26Z.
Windows validation of the submitted head
e8d947d31cfdde0d8e27b4563e2a73a416fdad25:BUILD_TESTING=ON, pinned submodules.guest_savedata_blocks,guest_savedata_search,guest_savedata_delete,guest_savedata_convert,guest_savedata_mount_status,guest_savedata_ps4,guest_savedata_cancel, andguest_savedata_dialog(0.21 s total, 30 s per-test limit).An additional compatibility probe found a problem with allocation records produced by current main. Reproduction through the actual library:
.blocksfile with the binary bytes80\r\n.sceSaveDataGetMountInfo.On this PR, the process terminates with:
Exit code:
0xC0000409. The same probe executable against rebuilt main31bfc4e86succeeds and reportsblocks=80 free_blocks=80. Main'skeep_save_blockswrites the number followed by a newline using a text-mode stream, producing this CRLF format on Windows; this PR'sdirectory_blocksrejects every non-digit byte.Main has also merged #5094, which already records allocations, calculates free blocks, and deletes the sidecar. This PR currently conflicts in
Export.cpp. The legacy-save behavior still differs: this PR infers a minimum 96-block allocation from usage, whereas main reports the maximum until a mount supplies an allocation. That difference needs to be reconciled separately from the newline compatibility fix.For comparison, main's 7 corresponding save-data/dialog tests passed (0.57 s total); it does not register
guest_savedata_blocks. This is targeted native Windows validation, not a complete runtime suite or Minecraft/title validation.AI-assisted: yes (OpenAI Codex).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T17:59:24Z.
Closing: #5094 (merged today) already records the creating mount's block count in the same
<dir>.blocksfile and reports it from bothsceSaveDataGetMountInfoandsceSaveDataDirNameSearch(save_blocks/search_infoinExport.cpp), so this PR now conflicts with main inExport.cppand duplicates that mechanism.What is not on main is the fallback for a directory with no
.blocksrecord (its files rounded up to the 96-block minimum instead of 32768) andcreate2 && !existswhen recording. If you still want those, please reopen or send a small PR on top of current main with just that part, reusing the existingsearch_infohelpers and a test that fails without it. The Conventions check on the current head is also red, so please check it when you rebase.Pull request closed