feat(sysmodule): answer IsCameraPreloaded and forward UnloadModuleByNameInternal #22362
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22362"
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-17T12:54:38Z.
What
sceSysmoduleIsCameraPreloadedreturns 0 in a PS5 process.sceSysmoduleUnloadModuleByNameInternalforwards tosceKernelStopUnloadModule. Onmainboth are parameterless declarations that throw.Source. @BunnyFl's reading of
libSceSysmodule.sprx(13.42) on #21866 (comment). It is disassembly only, not measured on a console.sceSysmoduleIsCameraPreloaded(void)(0xcd0) askssceKernelIsPs4Process(). In a PS5 process it returns 0 (xor eax,eax; ret) and reads no argument. Its PS4-process path (0x29b0) wasn't read.sceSysmoduleUnloadModuleByNameInternal(0xba0) is a tail jump intosceKernelStopUnloadModule, withr8moved tor9andr8set to 0. So(handle, args, argp, flags, result)becomessceKernelStopUnloadModule(handle, args, argp, flags, NULL, result). It has no checks of its own and takes no name, despite its name.Change (
Export.cpp,Api.hpp,CMakeLists.txt).IsCameraPreloadedreturns 0 unlesssceKernelIsPs4Process()reports a PS4 process, where it throws.libSceSysmodulenow linkslibkernel_sysfor that call.UnloadModuleByNameInternalforwards with a null option.Debt. Following the fragment rule, this adds
docs/dev/debt/changes/feat-sysmodule-camera-preloaded.md. It takes the two names out of the five-export "no credible prototypes" entry and adds an entry citing the reading. The other three (IsCalledFromSysModule,MapLibcForLibkernel,PreloadModuleForLibkernel) stay as they are. The fragment folds cleanly in isolation.Test (
GuestSysmodule.cpp, ctestguest_sysmodule). New rows, placed just before the existing finalsceKernelStopUnloadModulerow so the test merges with #18184, which appends after that row:UnloadModuleByNameInternalon handle0x7fffffffreturns whatsceKernelStopUnloadModulereturns for it, with the same result output;IsCameraPreloaded()returns 0. The test process is not a PS4 title.Tested
68d1761431. Windows 11 Home 25H2 (26200.9974), i7-11800H, WinLibs GCC 15.2.0 r7 UCRT, Ninja, Release,BUILD_TESTING=ON, onmaincb28e72762.guest_sysmoduleandguest_sysmodule-invalid-idspass. The newlibkernel_syslink builds with no warnings.main'sExport.cppwithUnloadModuleByNameInternalgiven the branch's signature, plus the branch's header and test. It aborts (0xc0000409) withsceSysmoduleUnloadModuleByNameInternal not implemented, whose row comes first.Export.cppwith onlyIsCameraPreloaded's body put back tomain's. It aborts withsceSysmoduleIsCameraPreloaded not implemented.guest_sysmodule-invalid-idspasses under both controls.c3f9593c5aapplied with 28 other PRs onmainfd4aeed483. Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, RTX 3080.guest_sysmodulepasses. Of its nine whole-batch failures, four also fail onmainand three are intermittent. The other three (guest_agc_driver_unknown,guest_load_ranges,tool_script_modes) weren't traced to a single PR. This is one combined tree, not this PR alone.sceKernelIsPs4Process()is 0.IsCameraPreloaded()returned 0 on two calls.UnloadModuleByNameInternalon handles0xffffffff,0x7fffffffand0x12345returned0x80020003with the result untouched, the same assceKernelStopUnloadModule(handle, 0, NULL, 0, NULL, &res), and a null result pointer was accepted. A real handle couldn't be tested, since the module load failed.Debt interaction with #23240 (Thimo188,
MapLibcForLibkernelandPreloadModuleForLibkernel). The code merges cleanly. The fragmentfeat-sysmodule-is-called-from-sysmodule.md, which this branch deletes in the maintainer's main mergec3f9593c5a, is edited there. Whichever lands second drops the two-nameMapLibcForLibkernel and PreloadModuleForLibkernelentry from this PR's fragment; the details are in my comment there.git merge-treefinds no conflict withmainor with any open PR that merges withmain, including #18184.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-17T13:20:45Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
68d1761431:tools/check_conventions.pypassed.guest_sysmodule_testsbuilt cleanly.guest_sysmodule,guest_sysmodule_maps_scan):core/libs/prx/libSceSysmodule/Export.cpp,core/libs/prx/libSceSysmodule/include/Api.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T08:26:29Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the implementation and tests support merging at the reviewed head.
What I ran
Reviewed head
c3f9593c5aa8085a72552ea230bb659619a47f78. I read the prepared description, commits, manifest, diff, all included changed files, and the kernel unload implementation. No build or tests were run in this review; platform results in the description are author- or contributor-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not read the deleted debt fragment, files excluded by preparation rules, or unrelated repository files. I did not run tests or verify console behavior. The description reports Windows test results and PS5 measurements, but those were not reproduced here.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T14:47:58Z.
Review: APPROVED
Reviewed — looks good
Nothing in the reviewed code blocks merging; the implementation follows the described forwarding and PS5 return behavior, with the PS4 path intentionally left unimplemented.
What I ran
Reviewed head
16bbdee2f713bd4dcbecfe0b69a108381fb198f7. Read the prepared description, commits, diff, manifest, all five included changed files, and targeted implementation and caller context usingrepo_read.py. No build or tests were run in this review.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The deleted file
docs/dev/debt/changes/feat-sysmodule-is-called-from-sysmodule.mdwas excluded because it has no added text; its prior contents are visible in the prepared diff. Build/test reports in the description are author- or reporter-supplied and were not independently reproduced. PS4-process behavior forsceSysmoduleIsCameraPreloadedremains unverified as stated in the change documentation.To get this to a good state
Nothing is required.
Sources
The change's behavior is documented in
docs/dev/debt/changes/feat-sysmodule-camera-preloaded.md; the forwarding implementation is atcore/libs/prx/libSceSysmodule/Export.cpp:469-470, andsceKernelStopUnloadModuleis declared and implemented with the matching argument order.