mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-04 13:07:32 +00:00
sceSaveDataRegisterEventCallback and sceSaveDataUnregisterEventCallback were parameterless declarations that threw. They now follow shadPS4 #5226: registering before initialization is NOT_INITIALIZED, a null callback is PARAMETER, a second registration replaces the callback and its userdata, and unregistering needs no initialization. Every backup completion that queues an event for sceSaveDataGetEventResult, type 2 from sceSaveDataBackup and type 1 from sceSaveDataUmountWithBackup, is queued for polling first and then handed to the callback registered at that moment. A library thread delivers it: sceSaveDataInitialize3 starts it with scePthreadCreate, as libSceUsbStorage starts its monitor, so the callback runs on a guest thread, and the last sceSaveDataTerminate joins it. Unregistering waits for a running callback and drops completions not yet delivered, and a terminate from inside the callback returns BUSY instead of joining its own thread, as shadPS4 does. guest_savedata_event_callback covers the errors, both event types, the delivering thread, unregistration, replacement, a terminate from inside the callback and an idle terminate followed by a restart.