Commit Graph

8 Commits

Author SHA1 Message Date
Dean a7836b1495
Merge pull request #5094 from bubblegg/fix/savedata-save-size
fix(savedata): report a save's size as the mount that created it gave
2026-10-14 15:47:32 +13:00
SandstromPL d34b78890d fix(savedata): return no saves for a search with another title's ID
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 17:53:29 +05:30
bubblegg 4b7a357bd2 fix(savedata): report a save's size as the mount that created it gave
Every native save reported SAVE_DATA_BLOCKS_MAX blocks, all of them free,
in the sceSaveDataDirNameSearch infos and in sceSaveDataGetMountInfo,
whatever the title created it with and whatever its files held. A save's
size is now the blocks of the sceSaveDataMount3 call that created it,
kept beside the save; a save without a kept size takes that of its next
mount that names one, and otherwise keeps SAVE_DATA_BLOCKS_MAX. Free
blocks are what the save's files leave of it, each file rounded up to
32 KiB blocks, and the blocks and free-blocks sort keys use both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 11:32:43 +00:00
xXPBSXx 989504ed84 feat(libSceSaveData): answer sceSaveDataDirNameSearch2
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 22:59:26 +02:00
Yunus Shaikh 12ef40e4f1 fix(savedata): let a trailing % in a directory name pattern match nothing
sceSaveDataDirNameSearch reads % in the directory name pattern as any
run of characters and _ as one character. The matcher stopped when the
name ran out and then required the pattern to have ended too, so a
trailing % with nothing left to match failed: SAVEDATA% did not find a
save named SAVEDATA, and TRAI_% did not find TRAIL. A % now matches no
characters at the end of a name as it already did in the middle.
2026-10-12 06:37:37 -07:00
pallp 4b125c0ca5 fix(savedata): fill the search infos of sceSaveDataDirNameSearch
SaveDataDirNameSearchResult.infos points at an array the title reads one
entry per returned directory name, but the search never wrote it, and
SaveDataSearchInfo was declared as 128 opaque bytes. A title that asks for
the infos read whatever its buffer held.

SaveDataSearchInfo is now the 48-byte record shadPS4 declares as
OrbisSaveDataSearchInfo (blocks, free blocks, 32 reserved bytes), and the
search fills one per returned name. Every native save reports
SAVE_DATA_BLOCKS_MAX blocks, as sceSaveDataGetMountInfo and the block sort
keys already assume, so both counts are SAVE_DATA_BLOCKS_MAX and the
reserved bytes are zero.

guest_savedata_search_tests checks the two records, their zero reserved
bytes and that the search writes nothing past them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VFVE5WbaUJ2vyj8NAW44CS
2026-10-12 02:18:33 +01:00
Yunus Shaikh 9b1e1ecccd fix(savedata): sort sceSaveDataDirNameSearch results by the requested key and order
The search returned saves in host directory order and ignored the condition's key and order. A title that asks for the newest save first (modification time, descending) got whichever directory the host listed first: the alphabetically first on NTFS, an arbitrary one on Linux. Sort by directory name, user parameter or modification time, reverse for a descending order, and reject unknown keys and orders with the parameter error, as shadPS4 does.
2026-10-11 10:46:53 -07:00
TibixDev 2085f4560d fix(savedata): use 32-byte directory records
The 36-byte SceSaveDataDirName declaration placed every search result
after the first at the wrong address and could overrun guest arrays.
Skyrim read an empty directory name for its second save and aborted
when mounting it. Use the 32-byte layout also used by the native dialog,
KytyPS5 src/libs/libSaveData.cpp and fpPS4 ps4_libscesavedata.pas.

Add a regression using two maximum-length names, a guest buffer guard,
and mounts of both returned records. It detects the previous overrun.
Fedora 44 Release search, dialog, delete and PS4-save tests pass. Skyrim
now mounts and reads the second save instead of rejecting its name.

Written with AI assistance.
2026-10-08 01:34:20 +03:00