feat(libkernel): implement sceKernelGetAppInfo #3056
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3056"
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 TheAggie on 2026-10-10T21:28:33Z.
What
sceKernelGetAppInfo(G-MYv5erXaU) isn't exported. XPSemu (PPSA97358) stops on it at start-up onmain:XPSemu calls it with its own pid to read its title ID (
ui/xui/dashboard.cc,OwnTitleId). It declares the structure as{ uint32_t app_id; uint64_t unknown1; char title_id[14]; char unknown2[0x3c]; }, so the title ID is at offset 0x10. That matches shadPS4'sOrbisKernelAppInfo(cusa_name[10]after four 32-bit fields).sceKernelGetAppInfo(pid, info):app_id1 (the running title's id inlibSceSystemService) and thetitleIdfrom/app0/sce_sys/param.jsonat offset 0x10, up to 9 characters plus a terminator. Only these two fields are written, because callers declare the structure with different sizes.ESRCH.info: returnsEFAULT.Test (
guest_app_info):app0/sce_sys/param.jsonand switches into it.ESRCHandEFAULTcases.Tested
mainb8a083b2it stops atG-MYv5erXaU. With this PR it moves on to0Ma-LQjv6So(cpuset_setaffinity), which no open PR implements.guest|kernel|processtests: 238 passed, 1 skipped, 1 failed. The failure isguest_memory, which fails the same way onmainhere (CheckGuestModuleImageProtection'sdlopen).tools/check_conventions.pypasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T21:28:56Z.
Progress report (
bae9962→3974857)📈 System libraries: 85.81% (+0.01%, +1 implemented functions)
✅ 1 implemented
sceKernelGetAppInfoImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T22:04:58Z.
Review: CHANGES_REQUESTED
Thanks, the layout (title ID at +0x10) matches SharpProspero's
SceKernelAppInfoand shadPS4'sOrbisKernelAppInfo, andguest_app_infofails without the change. A few things to fix:core/libs/prx/libkernel/System/src/Process.cpp:210-218:param.jsonis parsed by hand withfind.libkernel/AppMetadataalready parses it (ParamJsonParser,GetAppTitleId_nid_postfix); please reuse it so there is one rule for it (and its validation, e.g. a missing or emptytitleIdthrows there).Process.cpp:205-206:EFAULTfor a nullinfoandESRCHfor another pid have no source. shadPS4 returnsEPERMfor a pid other than its own andORBIS_OKfor a nullinfo. Either follow a reference or keep unverified cases throwing.Process.cpp:220:app_id= 1 is not sourced. If it is inferred, say so.docs/dev/TechnicalDebt.md: no line. Add one under "Unknown function info" for the app ID value, the error codes, and that onlyapp_idand the title ID are written.core/libs/tests/GuestAppInfo.cpp: add the case withoutparam.json.Process.cpp:30:<string>is out of alphabetical order.Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-10T22:16:15Z.
Linux check, since the description says it wasn't run there: 431f8044 merged onto
mainecafb64f(clean), Ubuntu 24.04, GCC 13, Release.guest_app_infopasses 5/5 (--repeat until-fail:5).sce_module/libc.prxunwrapped (#2605):mainstops atundefined symbol: G-MYv5erXaU; with this PR it goes on toundefined symbol: 0Ma-LQjv6So(cpuset_setaffinity), the same as your Windows run.cpuset_setaffinityfor the calling thread is ready on babyhuey:feat/libkernel-cpuset-setaffinity; I'll open it once this is in and it is XPSemu's stop onmain.Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-10T22:43:36Z.
Review: COMMENTED
This one answers the question this tree always asks before anyone has to: a named title (XPSemu, PPSA97358), the exact failing line, the caller's own structure quoted from its source, and a second reference in shadPS4's
OrbisKernelAppInfoto confirm the layout. That is the shape a bring-up fix should have.The partial write is the right decision, and the test pins part of it rather than describing it. Writing only
app_idand the title id and leaving the rest of the caller's structure alone is correct precisely because callers declare that structure at different sizes.guest_app_infodoes check that a byte past the written fields (unknown2[0]) is unchanged — thoughunknown1, sitting between the two written fields, goes unchecked, so the property the reasoning rests on is only half-pinned.The details line up with the tree and with the reference. Nine characters plus a terminator is ten bytes, matching shadPS4's
cusa_name[10]exactly; the running title's app id is1on the console side (SYSTEM_SERVICE_RUNNING_APP_ID, which lives inlibSceSystemServicerather than libkernel — likely why the value appears here as a literal); and the test failing when the title-id parsing is removed is the evidence bar this tree asks for.On the title-id read, the maintainer's point stands, and the evidence makes it firmer than a preference.
AppMetadataexposesGetAppTitleIdandParamJsonParserexposesparseParamJsonreturning atitleId; both are in the samelibkerneltarget and already consumed by sibling directories (Apr,File) and by other libraries, soSystem/reachingAppMetadatais not a layering problem here. The read as written is anifstreamplus afindon"titleId", which also means a missing or malformedparam.jsonyields an empty title id instead of surfacing as one — where the existing parser is the path with validation and tests already in it. adriadam10 has asked for this reuse in review already, so treating it as the one thing to settle before this lands seems right. Everything else here is in good shape.Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-10T23:28:02Z.
Thanks @adriadam10, @babyhuey and @Dextroid17. Addressed in e7a06d00:
Title ID: now read through
GetAppTitleId_nid_postfix, soparam.jsongoes throughParamJsonParserand its validation. A missing file, or a missing or emptytitleId, throws there. The hand-writtenfindis gone.Error codes: these now follow shadPS4 (
sceKernelGetAppInfoinsrc/core/libraries/kernel/kernel.cpp). Another pid returnsEPERM, and a nullinforeturns 0 without writing anything.app_id= 1: this is inferred, not measured. It's the running title's id inlibSceSystemService(SYSTEM_SERVICE_RUNNING_APP_ID). shadPS4 zero-fills its whole structure and leavesapp_idat 0. I kept writing onlyapp_idand the title ID, because callers declare the structure at different sizes. Zeroing shadPS4's larger layout could write past XPSemu's.guest_app_info:param.jsonit writes now haslocalizedParameters, as the parser requires.unknown1, between the two written fields, is left alone.param.jsonin a child process and expects that process to fail. The throw comes from insidelibkernel.prx, and on Windows the test executable can't catch that one itself.Includes: the stray
<string>,<algorithm>and<iterator>are gone.TechnicalDebt (d09b3372): a line under "Unknown function info" for the guessed
app_id, the shadPS4 error codes, and the partial write.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T07:08:01Z.
Review: APPROVED
Rebased onto current
main(only conflict: adjacent TechnicalDebt line, kept both).Checked:
guest_app_infopasses on the rebased tree and fails to link without the change; the title ID goes throughGetAppTitleId_nid_postfix; error codes and the partial write are recorded in TechnicalDebt under "Unknown function info"; Linux run by @babyhuey confirms XPSemu moves on tocpuset_setaffinity. Merging.