feat(libkernel_sys): answer sceKernelGetAppCategoryType from the app info record #14216
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14216"
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 zaryabzip on 2026-11-01T00:24:47Z.
What
sceKernelGetAppCategoryType(int pid, uint32_t* category)in libkernel_sys now answers instead of throwing:categoryreturnsEINVAL(0x80020016);sceKernelGetAppInfofills forpid, and returns that call's result.This follows @BunnyFl's reading of firmware 13.42's libkernel, from disassembly.
sceKernelGetAppCategoryTypedoesn't callsceKernelGetAppInfo, but both send the same request,sysctl({1, 0xe, 0x23, pid}), for the same 0x58-byte record.GetAppInforeturns the whole record;GetAppCategoryTypereturns only theuint32at+0x50, or0x80020016for a null output.Reading through
sceKernelGetAppInfokeeps the two consistent:The camera module calls this on every
sceCamera2*call, so it decides those answers. A follow-up PR uses the same field.The debt entry says what wasn't read:
libkernel_sys gains one implemented function.
The new
GuestKernelSysAppCategory.cpp:app0/sce_sys/param.jsoninto a temporary directory, asGuestAppContentLicense.cppdoes, becausesceKernelGetAppInfofor the caller's pid loads the title id;sceKernelGetAppInfo's record and checks that nothing past the four bytes is written;EINVALfor a null output.It calls the export through a cast of its address, so it builds on
main, where the export is parameterless.Tested
Windows 11 (WinLibs MinGW-w64 GCC 15.2.0 UCRT r7, CMake 4.3.1, Ninja 1.13.2) and Ubuntu 24.04 on WSL2 (GCC 13.3.0, CMake 3.28.3, Ninja 1.11.1), both with the head
0b13ef8fd5merged intomain8a4fc62318.libkernel_sys/include/Api.hpprebuilds with no warnings (26 on Windows, 27 on WSL2), and so does each header compiled on its own.ctest -R "guest_kernel_sys|guest_offline_imports": 26 of 26 pass on Windows and 28 of 28 on WSL2.guest_kernel_sys_app_categorypasses 3 of 3 on--repeat until-fail:3.mainwith only the new test file and itsCMakeLists.txtblock, the test builds and aborts withsceKernelGetAppCategoryType not implemented(Windows exit 0xc0000409, Linux SIGABRT).tools/check_conventions.pypasses, andgit merge-treemerges this cleanly with every open pull request that merges withmain.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 MarcZX10 on 2026-11-01T01:25:47Z.
Review: APPROVED
Reviewed — looks good
The wrapper follows the firmware-derived query by delegating record lookup to
sceKernelGetAppInfoand copying its category field.What I ran
Reviewed head
0b13ef8fd52d13841fde1154b4848892142b3da4, based on PR basecbcb37b3140db682277a9c51d950b90ce75de784; the merge preview onto currentmain666d9b10a5152919bb21cd47537ac5e408c4bca4was clean. Environment: Debian Linux x86_64, Python 3.11.2, Git 2.39.5. I did not build locally.Results
Unedited conventions output
Findings
Blocking
None.
Non-blocking
The test compares the output with the same record API this wrapper delegates to, so it chiefly checks forwarding, the selected field, and write bounds. The firmware disassembly cited in the PR supplies the independent behavior evidence.
Sources
Not verified
No local build or C++ tests were run. Linux CI was skipped. The firmware-derived behavior and author-reported Windows/WSL2 tests were read but not independently reproduced.