Skip to content

fix(libSceSaveData.native): answer sceSaveDataCancel before initialization as measured in a PS5 payload - #11720

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
ionut27001:fix/savedata-cancel-not-initialized
Oct 29, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
ionut27001:fix/savedata-cancel-not-initialized

Conversation

@ionut27001

Copy link
Copy Markdown
Contributor

What

sceSaveDataCancel threw for every call. Marvel's Wolverine (PPSA03671) imports it from libSceSaveData.native.

In a payload process on a PS5 (firmware 12.70), sceSaveDataCancel from /system/common/lib/libSceSaveData.native.sprx returned 0x809f0001 (SAVE_DATA_ERROR_NOT_INITIALIZED) for the arguments 0, 1, 2 and 0xffffffff before the library was initialized. In an earlier payload run on the same console, libSceSaveData.sprx loaded but did not resolve sceSaveDataCancel by name.

This change returns SAVE_DATA_ERROR_NOT_INITIALIZED while the library is not initialized, using the same g_initializations check as the other save-data calls. Once the library is initialized, the call still throws. In the same payload process, sceSaveDataInitialize3(NULL) never returned a result, so the initialized case was not measured. The debt entry records that gap.

Measured log (case lines, payload process, firmware 12.70):

case load path=/system/common/lib/libSceSaveData.native.sprx ret_ok=1 ret=0x21 start_result=0
case resolve module=libSceSaveData.native.sprx sceSaveDataCancel found=1
case resolve sceSaveDataInitialize3 found=1 sceSaveDataTerminate found=1
case cancel phase=before_init arg=0 ret=0x809f0001
case cancel phase=before_init arg=0x1 ret=0x809f0001
case cancel phase=before_init arg=0x2 ret=0x809f0001
case cancel phase=before_init arg=0xffffffff ret=0x809f0001

The next call, sceSaveDataInitialize3(NULL), produced no further output before the runner's 60-second timeout, so it either hung or ended the process.

Overlaps: no open PR changes sceSaveDataCancel. #11697, #11080, #11083, #8285, #8630 and #7780 edit the same files elsewhere.

Tested

Windows 11, WinLibs GCC 15.2.0, Release, on main 9cc1a37:

  • With this change: guest_savedata_cancel passes twice. It checks the four measured arguments before initialization, that the call still throws after sceSaveDataInitialize3, and that it reports not initialized again after sceSaveDataTerminate.
  • Revert check: with Export.cpp from main, the test aborts (0xc0000409), because the call throws before initialization.

Not tested on Linux, nor with a title.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the exact current head 410e7c4c18cb51d174f53317d7834a13dd662cd6, the focused implementation/test/debt update, and the current-main merge preview. The g_initializations check is consistent with the measured pre-initialization results for all four arguments, and the test covers the uninitialized → initialized/still-unimplemented → terminated lifecycle. The debt entry accurately records the unknown initialized console behavior. git diff --check passes and the merge preview is clean.

I did not rerun the Windows test locally; the PR reports two passing runs plus a revert control, and current hosted product build jobs are skipped by path policy.

@adriadam10 adriadam10 self-assigned this Oct 28, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 28, 2026
@Ondra97 Ondra97 mentioned this pull request Oct 28, 2026
12 tasks done
@adriadam10
adriadam10 force-pushed the fix/savedata-cancel-not-initialized branch from 410e7c4 to a21f985 Compare October 28, 2026 14:42
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 28, 2026
@JJenkx

JJenkx commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Windows run of this head (a21f985dcf), merged onto main 3a2b919816 (clean merge, local only). Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7, Ninja, Release, BUILD_TESTING=ON, no Vulkan driver visible.

  • This PR: guest_savedata_cancel passes 3 of 3 (ctest --repeat until-fail:3).
  • Negative control: with core/libs/prx/libSceSaveData.native/Export.cpp put back to main's version and everything else from this PR, guest_savedata_cancel fails.

AI-assisted: yes (Claude Code).

@adriadam10
adriadam10 merged commit 5a88858 into boykopovar:main Oct 29, 2026
10 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Rebased onto current main (04fefeb): #12014 changed GuestSaveDataCancel.cpp in the meantime, and its test asserted the throw before initialization that this PR replaces. We kept this PR's test, which checks the measured SAVE_DATA_ERROR_NOT_INITIALIZED for 0, 1, 2 and 0xffffffff before initialization, that the call still throws after sceSaveDataInitialize3, and that it reports not initialized again after sceSaveDataTerminate. The rest of the diff is unchanged. Build and scoped ctest on the rebased commit pass; the merge queue's full Build is the gate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants