fix(savedata): persist native save icons #8630
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8630"
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 Ondra97 on 2026-10-20T19:05:28Z.
What
sceSaveDataSaveIconpreviously returned success without storing bytes, andsceSaveDataLoadIconreturned success with a zero data size. The native buffer APIs now persist and reload the mounted save'ssce_sys/icon0.pngthrough the existing disk path resolver andsavedata::replace_file.Save writes
min(buf_size, data_size)bytes. Load copies at most the destination capacity and reports the full stored size. Missing icons returnNOT_FOUND, invalid icon/buffer pointers returnPARAMETER, and I/O failures returnINTERNAL. Buffer clipping and full-size reporting follow shadPS4's implementation. PS5 image validation, size limits and error precedence remain unmeasured and are recorded in debt.The earlier revision also imported a PS4 read-only rejection. That breaks the reported Persona 5 Royal (PPSA05110) save sequence: a
0x31mount followed by successfulPreparecannot save its icon and the caller skipsCommit. This revision removes that unsupported access check and its slot state. It preserves main's accepted sequence while actually storing the icon. It does not infer PS5 transaction semantics from the title:Prepare/Commitremain as on main, and mount-access enforcement is deferred until that contract is established.The new
prepared_create2regression runsCreateTransactionResource -> Mount3(0x31, 48 blocks) -> Prepare -> SetParam -> SaveIcon -> Commit -> Umount2(0x10001), then remounts and verifies the exact icon bytes. It repeats with an existing save, different content and a shorter icon. The other cases cover separate saves, working-directory changes, clipping, zero lengths, overwrites, loading through a read-only mount, invalid arguments and I/O failure cleanup. This addresses icon persistence (C5 in #8005), without claiming a transaction implementation or title compatibility.The current-main refresh retains icon persistence and its six-case regression. Both icon entry points now use main's existing
isValidMountPointvalidation together with the icon/buffer checks. The mount-status fixture preserves main's added assertions while supplying valid icon buffers, saving before loading, and expectingPARAMETERfor a null icon before mount lookup. A valid buffer on an unmounted point still returnsNOT_MOUNTED. This retains the existing, explicitly unverified error-precedence contract.The November 3 integration preserves all current main mount, backup and event-callback behavior. The icon I/O implementation changes only at the initial mount-point validation; the six-case fixture retains its exact source blob.
Tested
November 3, 2026 (Europe/Prague): main
5cb015caaaaf83f8ee431414ee6a457b5b307d49, submitted headab8360ee1e7dddeead7d22bc6b7ed19056f2b7ad.Windows 11 Pro 10.0.26300; AMD Ryzen 9 7900X; 31.7 GiB RAM; WinLibs GCC 15.2.0 r7 UCRT; Ninja Release;
BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=ON, pinned bundled dependencies, isolated workspace temporary directories. These are CPU/runtime fixtures, not GPU qualification.GuestSaveDataIcon.cppremains Git blobf743eb6cf656edcf6f37a14554409cbee3e03229. No read-only rejection or title-specific transaction state is added.Reproduction with the supported toolchain on PATH and an isolated temporary directory configured:
This verifies focused runtime fixtures against current main. No new Persona 5 Royal in-game save, console transaction/access measurement, full CTest run or mixed-PR qualification is claimed. Older evidence retains its exact source and platform attribution below.
Earlier source-pinned validation
November 1 current-main refresh: base
f2d874c1fdccf781c0fa5d86619bb5dd8894b958, submitted headd154e94cca15d49b9d39eb64e153df646e8cf330. Windows 11 Pro 10.0.26300, AMD Ryzen 9 7900X, 31.7 GiB RAM, NVIDIA GeForce RTX 4070 Ti SUPER (CPU fixtures only), WinLibs MinGW-w64 GCC 15.2.0 r7 UCRT, Ninja Release,BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=ON, pinned bundled dependencies, workspace-local temporary test directories.The CMake conflict retains main's
guest_savedata_host_spacetarget/registration and all six icon cases. All current mount-status/PS4 and native save-memory coverage remains. The two icon function bodies match the previous submitted head exactly, andGuestSaveDataIcon.cppretains Git blobf743eb6cf656edcf6f37a14554409cbee3e03229. Original implementation/review-fix commits and authorship are preserved without rewriting history.public_headersinventory audit also passes, 1/1.Mount3(0x31, 48 blocks) -> Prepare -> SetParam -> SaveIcon -> Commit -> Umount2(0x10001), shorter overwrite, remount and exact byte checks. The code does not add a transaction state or reintroduce the unsupported read-only rejection.Reproduction with the supported toolchain on PATH:
This update validates the unchanged persistence implementation against current main's surrounding APIs and tests. It does not claim a Persona 5 Royal in-game save, a console transaction/access contract, a complete CTest run or a new mixed-PR runtime result. Earlier negative controls and independent reviewer runs retain their original revisions below.
Earlier validation (historical source pins and environments)
Revalidated on 2026-10-30: base
3948413d701b093b32a194f5fe5525ea8d5f5079, submitted headfb3759c10c428d0b29ba95055c452d204a231504. Main was merged into the existing branch without rewriting its original icon/public-header/prepared-CREATE2 history.Windows 11 Pro 10.0.26300; AMD Ryzen 9 7900X, 31.7 GiB RAM, NVIDIA GeForce RTX 4070 Ti SUPER (the fixtures use the CPU). WinLibs MinGW-w64 GCC 15.2.0 r7 UCRT; Release,
BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=ON, pinned bundled dependencies, workspace-localTEMP/TMP.The full production
relinkerandlibsbuild, patched-library checker and every fixture selected below passed on the submitted sources. 21/21 SaveData/patched-library CTests passed, zero failures or skips, including all six icon modes and the reconciled mount-status test. All 374 patched libraries loaded, zero failures. The public-header audit checked 374 libraries and 14722 exports for unique declarations and umbrella coverage.The prepared-CREATE2 case covers a new and existing save,
Mount3(0x31, 48 blocks) -> Prepare -> SetParam -> SaveIcon -> Commit -> Umount2(0x10001), a shorter overwrite and exact bytes after remounting. The two icon functions and the dedicated six-case icon fixture are byte-identical to the previously submittedd3b5b39a255405ab0894684259a388922067affa; only the integration fixture required adjustment. The earlier failing control and independent reviewer runs remain historical evidence below.Conventions, strict main synchronization, registration and whitespace checks pass. The overlap scan completed; its remaining shared-file comparisons are #10674 (progress signature), #12846 (debt) and #12853 (bounded mount-point validation and mount-status assertions). Their shared patches do not implement icon persistence. When composing #12853, retain its bounded mount-point validation alongside this PR's icon validation and save-before-load fixture order. No peer dependency, author agreement or mixed-stack runtime result is claimed.
No new title or console run and no complete CTest suite is claimed. Persona 5 Royal making an in-game save remains untested; synthetic host sequences do not establish PS5 transaction semantics. Earlier evidence and attributed reviewer runs are retained below with their own revisions.
Earlier submitted-revision validation and reviewer evidence (historical)
Windows 11 Pro 10.0.26300; AMD Ryzen 9 7900X, 32 GB RAM, NVIDIA GeForce RTX 4070 Ti SUPER. WinLibs GCC 15.2.0 UCRT r7; Release, `BUILD_TESTING=ON`, workspace-local `TEMP`/`TMP`.Validated on 2026-10-26 against main
afc780e681fc379a6ed1b19a2a247cae17f0fc07, final headd3b5b39a255405ab0894684259a388922067affa. The existing PR history and public-header cleanup are preserved; that main revision was merged without rewriting the branch.The new regression was built on the merged pre-fix tree
66ea6b3290458f41f5c93b28458799c7c8a81e29with only the new test/registration added. All three attempts failed at the SaveIcon success assertion. With the fix, all six icon cases passed three consecutive runs each. Both new-save and existing-save cycles complete and the icon survives remounting.The full Windows runtime build (
relinker,libs, patched-library checker and every fixture selected below) passed on the submitted sources. All 21 selected CTests passed, with no skips; 368 patched libraries loaded with zero failures. Conventions, strict main-sync, test registration, the public-header declaration audit and whitespace checks passed. The public-header audit checked 368 libraries and 12,262 exports.Independent reviewer runs of the same PR head:
d3b5b39a2merged cleanly onto maine2d457be3; Ubuntu 26.04 x86_64, Intel Core i7-8700 (6 cores / 12 threads, AVX2), GCC 15.2, Release,BUILD_TESTING=ON. The build and all 21 SaveData/patched-library tests passed. The six committed icon cases andguest_savedata_mount_statuseach passed 20 repeated runs. Restoring main'sExport.cppmade all six icon cases fail while mount-status still passed.d3b5b39a25merged onto main3a40945e62; Windows 11 26200, WinLibs GCC 15.2.0 r7, Release. All seven locally registered icon cases passed in each of three rounds: the six committed cases plus the reviewer's separate replay ofMount3(0x31) -> Prepare -> SaveIcon -> Commit -> Umount2(0x10001). That separate case had failed in all three runs on the earlier head748cdaf1e9. The seventh case is local to the reviewer's checkout.These results are attributed to the reviewers; this description update does not claim a new build or runtime run. Persona 5 Royal has not been tested making an in-game save: the reviewer's scripted runs do not yet reach a save point.
On 2026-10-28,
git merge-tree --write-tree --name-only origin/main d3b5b39a255405ab0894684259a388922067affacompleted without conflicts against main2f34dca5b32b4e12a3a028e2f9587a15ef79d077. This checks mergeability, not runtime behavior on that newer base.Manual review of #11720 at
410e7c4c18cb51d174f53317d7834a13dd662cd6found a separatesceSaveDataCancelinitialization change and debt edit, with no duplicate icon implementation. #12220 at21771c59d6077ee967262f2b1ddeb43c26dea18aadds icon assertions in the same mount-status test. Its unmounted-point/null-icon assertions expectNOT_MOUNTED, whereas this PR validates a null icon first and returnsPARAMETER; its surrounding fixture also loads before saving. Those expectations and test ordering need reconciliation when integrating the two PRs. Neither PR is a prerequisite for this icon implementation, and no combined runtime test is claimed.No game save, console module or game payload is used by the fixtures. No PS5 or real-title run was performed by this update; the title trace is the reviewer's evidence. The synthetic test confirms restored host behavior and icon persistence, not console transaction correctness. The hosted full Linux and Windows build jobs for this head were skipped; full builds require a collaborator-triggered workflow.
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 harisibrar1 on 2026-10-24T15:41:02Z.
Review: APPROVED
Checked against main
b607bfdc8band shadPS4 8d50471b (savedata.cppLoadIcon/SaveIcon,savedata_error.h):min(buf_size, data_size)write, the full-size report on load, NOT_FOUND for a missing icon, and BAD_MOUNTED (0x809F000D) on a read-only slot all match the cited shadPS4 code./savedataNmount point plus a fixedsce_sys/icon0.png, resolved through the absolute alias. Guest input can't reach it beyond picking a slot, and mount3 already rejects.,..,/,\and:in directory names, so I see no traversal route.read_onlyis set on every mount, and Umount2 resets the whole slot, so a reused slot can't inherit an old read-only flag. Looks good to me.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T01:20:59Z.
Review: COMMENTED
Linux run of the current head, since the tested section covers Windows only.
Machine: Linux x86_64, i7-8700 (6 cores / 12 threads, AVX2), Ubuntu 26.04, GCC 15.2, Release,
BUILD_TESTING=ON. Headd3b5b39a2merged ontomaine2d457be3(clean).TEMPoverride needed. All 21 tests matchingsavedatapluspatched_librariespass; the sixguest_savedata_icon_*cases andguest_savedata_mount_statuspass 20 of 20 repeated runs.main'sExport.cppand keeping the tests fails all six icon cases (roundtripatGuestSaveDataIcon.cpp:86, the other five at line 73, includingprepared_create2).guest_savedata_mount_statusstill passes onmain, as expected after its reorder.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.