refactor: one helper for the title's compiled SDK version (16 copies in 16 libraries) #26276
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 LeandroLP23 on 2026-11-23T15:52:04Z.
What
Sixteen libraries each define their own function that returns the compiled SDK version of the running title. They all read the same thing: the 32-bit field at offset
0x10of the process parameters.ApplicationProcessParameters_nid_no_patch()(declared inlibc/include/ApplicationHeap.hpp), thenmemcpyfrom+0x10. They are in AppContent, ContentExport, ConvertKeycode, GnmDriverCompat1, GnmDriverForNeoMode, Hmd, Hmd2, Http, Move, NpCommerce, NpWebApi, ScreenShot and VrTracker2. Four of them keep the parameters pointer in astatic, nine read it on each call, and the names differ (CompiledSdkVersion,compiledSdkVersion).sceKernelGetCompiledSdkVersion, which reads the same field (libkernel/SysExports.cpp). They are in Http2, VdecSavc2 and VideoRecordingP. Each picks its own value for a failure that cannot happen with a local output:0x99900000, or0xffffffff(VdecSavc2 also saveserrnoaround the call).Proposal
Add one helper next to the declaration it uses, in
libc/include/ApplicationHeap.hpp:The 13 direct readers would call it instead of their copy, with the same result. Only the libraries whose files no open pull request conflicts with would change in the first pull request; the others would follow as those land. #26274 does the same for the guest-errno failure return.
Questions
ApplicationHeap.hppthe right home, or would you rather have it inlibkernel(or have the callers usesceKernelGetCompiledSdkVersiondirectly)?sceKernelGetCompiledSdkVersioncallers move to the helper too? Their failure values would go, since the read cannot fail there. Or should they stay as they are?If this isn't wanted, say so and I'll leave the copies alone.
AI-assisted: yes (Claude Code)