feat(libSceUsbStorage): implement device management and mounting exports #6288
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6288"
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 fogydes on 2026-10-15T09:06:59Z.
What
Implements the 21 PlayStation 5 firmware 3.20 decrypted library exports for
libSceUsbStorage.prx(sysmodule0x000000d5), replacing theAPS5_DUMMY_FUNplaceholder:sceUsbStorageInit(void* attr)sceUsbStorageTerm(void)sceUsbStorageGetDeviceList(uint32_t* device_ids, uint32_t* count)sceUsbStorageGetDeviceInfo(uint32_t device_id, SceUsbStorageDeviceInfo* info)sceUsbStorageIsExist(uint32_t device_id)sceUsbStorageGetMountPointOfShellCore(uint32_t device_id, char* mount_point, size_t max_len)sceUsbStorageGetdentsOpen(uint32_t device_id, int32_t* out_fd, uint64_t* out_bufsize)sceUsbStorageGetdentsRead(int32_t fd, void* buffer, uint64_t bufsize, uint64_t* out_bytes_read)sceUsbStorageGetdentsClose(int32_t fd)sceUsbStorageRegisterCallback(int32_t event_type, void* callback, void* arg)sceUsbStorageUnregisterCallback(int32_t event_type, void* callback)sceUsbStorageRegisterCallbackForMapAvailable(uint32_t device_id, const char* directory, void* callback, void* arg)sceUsbStorageUnregisterCallbackForMapAvailable(uint32_t device_id, const char* directory, void* callback)sceUsbStorageRegisterCallbackForMapUnavailable(uint32_t device_id, const char* directory, void* callback, void* arg)sceUsbStorageUnregisterCallbackForMapUnavailable(uint32_t device_id, const char* directory, void* callback)sceUsbStorageRequestMap(uint32_t device_id, const char* subpath, int32_t flags, int32_t unk, char* out_mount_path, int32_t* out_status)sceUsbStorageRequestMapWSB(uint32_t device_id, const char* subpath, int32_t flags, int32_t unk, char* out_mount_path, int32_t* out_status)sceUsbStorageRequestUnmap(uint32_t device_id, const char* directory)sceUsbStorageClearFakeWriteProtection(uint32_t device_id)sceUsbStorageSetFakeWriteProtection(uint32_t device_id, uint32_t enable)sceUsbStorageSetFakeMapLockForDebug(uint32_t device_id, uint32_t lock)All symbols compute identical NIDs to decrypted firmware 3.20 SPRX exports. Tracks initialization lifecycle via atomic guards at translation-unit scope, enforces null pointer and bounds validation returning
SCE_USB_STORAGE_ERROR_INVAL(0x80F40002), reports empty devices cleanly returningSCE_USB_STORAGE_ERROR_NOENT(0x80F40004), and documents silent stubs indocs/dev/debt/libSceUsbStorage.md.Tested
core/libs/CMakeFiles/libSceUsbStorage.dir/prx/libSceUsbStorage/Export.cpp.objcleanly with MinGW-w64 GCC 15.2.0.ctest --test-dir build-relinker -j8); 167/167 passed (100%).python tools/check_conventions.py --base main(passed).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 github-actions[bot] on 2026-10-15T09:07:46Z.
Progress report (
0afa6a6→b516b50)📈 System libraries: 88.78% (+0.07%, +21 implemented functions)
✅ 21 implemented
sceUsbStorageClearFakeWriteProtectionsceUsbStorageGetDeviceInfosceUsbStorageGetDeviceListsceUsbStorageGetMountPointOfShellCoresceUsbStorageGetdentsClosesceUsbStorageGetdentsOpensceUsbStorageGetdentsReadsceUsbStorageInitsceUsbStorageIsExistsceUsbStorageRegisterCallbacksceUsbStorageRegisterCallbackForMapAvailablesceUsbStorageRegisterCallbackForMapUnavailablesceUsbStorageRequestMapsceUsbStorageRequestMapWSBsceUsbStorageRequestUnmapsceUsbStorageSetFakeMapLockForDebugsceUsbStorageSetFakeWriteProtectionsceUsbStorageTermsceUsbStorageUnregisterCallbacksceUsbStorageUnregisterCallbackForMapAvailablesceUsbStorageUnregisterCallbackForMapUnavailable⚪ 4 behaviourally empty (constant return or throw)
sceUsbStorageClearFakeWriteProtectionsceUsbStorageIsExistsceUsbStorageSetFakeMapLockForDebugsceUsbStorageSetFakeWriteProtectionImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-18T19:41:14Z.
Thanks for the PR. Closing it because the implementation doesn't match what we can check against, and nothing in it is tested:
SceUsbStorageDeviceInfo(0x360,device_idat 0,capacityafter the vendor string) doesn't match the layout recovered from the module in SharpProsperoUsbStorage.cs: 0x338 bytes, volume size at 0x0, vendor at 0x16, product at 0x120, serial at 0x228, flags at 0x330.sceUsbStorageGetDeviceList(uint*, int*),sceUsbStorageGetMountPointOfShellCore(uint, char*)(no length),sceUsbStorageRequestMaptakes more arguments than declared here,sceUsbStorageGetDeviceInfo(uint, char*).0x80F40002..5and the/mnt/usb0mount path have no cited source. The body says they match decrypted firmware 3.20, but nothing in the PR shows that.RequestMap, and the fake write-protection calls return success without doing anything. Unverified paths must throw (NotImplemented_nid_no_patch). The getdents table is never filled, soGetdentsReadis unreachable.You're welcome to reopen with the signatures and struct taken from a cited source, only the behaviour you can verify implemented (the rest throwing), and a registered guest test that fails without the change.
Pull request closed