feat(libSceSystemService): initialize the launcher utility and answer the app-message query #8651
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8651"
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 nikowolf123 on 2026-10-20T20:04:32Z.
What
sceLncUtilInitialize and sceAppMessagingTryReceiveMsg were pending exports that threw.
sceLncUtilInitialize now returns 0 on its first call in the process and SCE_LNC_UTIL_ERROR_ALREADY_INITIALIZED (0x80940018) on every later one, from any thread. On a PS4 a launch made before the call failed with NOT_INITIALIZED (LightningMods' daemon writeup), Orbis Suite's loader treats any result other than 0 as a failure, and a homebrew app takes 0x80940018 for a client still initialized when it returns from another game; PS5 homebrew (playden-ps5, ps5-mcp) accepts 0 and 0x80940018 alike. No other call reads this state, and sceLncUtilTerminate still throws, so it never resets.
sceAppMessagingTryReceiveMsg returns SCE_APP_MESSAGING_ERROR_NO_MESSAGE (0x80C50005) and writes nothing, since AnyPS5 has no shell or other application that sends the title messages and sceAppMessagingSendMsg throws; a null message returns SCE_APP_MESSAGING_ERROR_NULL_POINTER (0x80C50004). The signature and both values follow StubMaker, which credits the PS4 values to psdevwiki; the 8216-byte message layout matches etaHEN's PS5 declaration.
Not confirmed on a PS5 and recorded as technical debt: the error values, that a title starts with the client uninitialized, and the order of sceAppMessagingTryReceiveMsg's null check.
guest_system_service now checks that the first sceLncUtilInitialize returns 0 and the next two 0x80940018, and that sceAppMessagingTryReceiveMsg returns 0x80C50004 for null and 0x80C50005 twice for an 8216-byte buffer whose bytes all stay unchanged. On main the test aborts at its first new call, which throws "not implemented".
Rebased onto current
mainand adapted to the declarations, test layout and debt fragments it has now. #17144, opened later, also implementssceAppMessagingTryReceiveMsg.Tested
Windows 11, WinLibs MinGW-w64 GCC 15.2.0 (ucrt, posix, seh), full build of this branch on current
main.ctestpasses for guest_system_service. Not run on a console or with a title.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-10-21T01:05:41Z.
Review: APPROVED
Reviewed the implementation, tests, and debt notes. The three former stubs now have explicit behavior and regression coverage; the unconfirmed PS5 details are clearly recorded as unknown rather than asserted as measured. I found no code defect in this diff. The hosted Linux/Windows and specialized build jobs are skipped on this PR, and the PR reports Linux test evidence, so this approval does not claim platform-matrix or console verification.
Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-21T03:07:11Z.
One console datapoint on the value this PR mirrors.
sceLncUtilGetAppIdOfRunningBigAppreturns 1 here becausesceSystemServiceGetAppIdOfRunningBigAppalready does onmain. On a PS5 (firmware 13.40, 2026-10-19),sceSystemServiceGetAppIdOfRunningBigApp()called inside a running retail title, Gran Turismo 7 (PPSA01317), returned 0x8094000F, not an app ID. The call was a ptrace remote call from an elfldr payload, which borrows a stopped game thread, calls the export the game itself resolved and restores the thread.So in that process the SystemService call answered with an error in the launcher range (0x8094xxxx) rather than 1. I did not call
sceLncUtilInitializeorsceLncUtilGetAppIdOfRunningBigAppthere, so I can't say whether the LncUtil export answers the same way, or whether initializing the launcher client first would change it. Since this PR makes the new export equal the existing one, the existing "Running application ID" answer of 1 may be the part worth checking. I can measuresceLncUtilInitialize,sceLncUtilGetAppIdOfRunningBigAppand the SystemService call in the same game process, in both orders, if that would help.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by nikowolf123 on 2026-10-21T03:17:33Z.
Thanks, that contradicts the value this PR copied. I took
sceLncUtilGetAppIdOfRunningBigAppout, so it throws again as onmain. The PR now covers onlysceLncUtilInitializeandsceAppMessagingTryReceiveMsg, rebased onto currentmain(a819544273,guest_system_servicepasses).Yes, that measurement would settle it. The most useful readings in one game process:
sceLncUtilGetAppIdOfRunningBigAppandsceSystemServiceGetAppIdOfRunningBigApp, each before and aftersceLncUtilInitialize;sceLncUtilInitializeitself returns there, on the first and on a second call.With that, the LncUtil export can return what the console does. The SystemService call on
main, which returns 1 (the "Running application ID" entry), can then be corrected in a separate PR.0x8094000Fis not in the public LncUtil error list (Lnc_errors.h), so its name would stay unknown.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T05:17:24Z.
Independent Windows run of this PR (data only).
Environment: Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release, BUILD_TESTING=ON. Merge-tree of the PR head against
mainis clean. I built onlyguest_system_service_tests;ctest -N -R guest_system_servicelists exactly one test.Results (3 runs each):
guest_system_servicepasses 3/3.core/libs/prx/libSceSystemService/Export.cpp,core/libs/prx/libSceSystemService/PendingExports.cpp,core/libs/prx/libSceSystemService/SystemService.hppwith the version from the PR's merge base (9f4ddf7cf9), then rebuilt. The test fails 3/3 (exit 0xc0000409). I restored the PR's files afterwards.Not run: other platforms, the other tests in the same family, the full repository CTest, and any title or console run.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-21T23:34:43Z.
@nikowolf123 here are the readings, all from one game process: Gran Turismo 7 (PPSA01317) on a PS5 with firmware 13.40, measured 2026-10-21. The calls are ptrace remote calls from an elfldr payload, which borrows a stopped game thread and calls the exports as the game's own libSceSystemService resolves them, in this order:
sceSystemServiceGetAppIdOfRunningBigApp()sceLncUtilGetAppIdOfRunningBigApp()sceLncUtilInitialize()sceLncUtilInitialize()againsceSystemServiceGetAppIdOfRunningBigApp()sceLncUtilGetAppIdOfRunningBigApp()sceLncUtilInitialize, so initializing doesn't change the answer, and the LncUtil and SystemService calls answer the same in this process.sceLncUtilInitializereturns 0 on both calls. These are the probe's first and second calls; whether the game had called it earlier isn't known.So the LncUtil export can return 0x8094000F like the SystemService one, and
sceLncUtilInitialize0 on every call. That's one process of one title; a title launched another way, or the shell, might get an app id.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T12:08:47Z.
Review: COMMENTED
Reviewed — no blocking findings
The change implements the two requested exports and records the unconfirmed console behavior as technical debt; no verified blocking defect was found in the inspected code.
What I ran
Reviewed head
ae779ab4b1bfeac20a85a3d773dfe876e73059ba. I read the prepared description, commits, manifest, diff, and all five changed files’ relevant changed sections. Repository files were read throughrepo_read.py; no commands or tests were run in this review.Results
Findings
Blocking
None.
Non-blocking
sceLncUtilInitializereturns success on every call, while the description’s opening claim says later calls returnSCE_LNC_UTIL_ERROR_ALREADY_INITIALIZED; the implementation, test, and debt entry instead consistently specify success on every call (core/libs/prx/libSceSystemService/Export.cpp:745). Align the description with the implemented behavior.Not verified
ctest, console, or title run was performed. The Windows build and test results in the PR description are author-reported.To get this to a good state
Nothing is required. Optional: correct the inconsistent description of repeated
sceLncUtilInitializecalls.