fix(libkernel): implement sceKernelWriteModifyMtypeProtectCommand and… #4258
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4258"
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 Dextroid17 on 2026-10-12T02:56:41Z.
… sceKernelWriteRemapIntoPrtCommand
Resolves NIDs hrEIwWDKm-w and RPAHEYSOt1s, absent from libkernel and needed by Trails in the Sky 2nd Chapter (PPSA35169). Both mirror existing, tested libSceAmpr recorders (sceAmprAmmCommandBufferModifyMtypeProtect and sceAmprAmmCommandBufferRemapIntoPrt): same AmmProtectCommand/AmmRemapCommand payloads, same opcodes (AmmModifyMtypeProtect=24, AmmRemapIntoPrt=27).
Adds TestKernelAmmRecorders() to GuestAmpr.cpp covering success + opcode/size, the reserved-field 1011 default and override, invalid-argument/null-buffer/ unbound-buffer rejection, and exact-size-then-busy.
See issue #4214.
What
Tested
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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T02:59:05Z.
Progress report (
34a16b7→1d63b11)📈 System libraries: 86.51% (+0.01%, +2 implemented functions)
✅ 2 implemented
sceKernelWriteModifyMtypeProtectCommandsceKernelWriteRemapIntoPrtCommandImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T03:04:18Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)sceKernelWriteModifyMtypeProtectCommandsceKernelWriteRemapIntoPrtCommandcore/libs/prx/libkernel/Apr/src/Recorder.cppImported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T03:31:10Z.
Carried by #4244 — a cherry-pick of my commit
1d63b117, so the patch and the author are preserved and the commit object is new — and that one has the PR template filled in. Thanks to @MarcZX100 for the carry.Verified before closing:
sha256 c3cebbada5cb586b1e6e559742802f12daa43d4539591ac4d6ee5b907480ff23for each, and even theindexblob SHAs match, so the resulting trees hash the same. Same three files, same line counts:core/libs/prx/libkernel/Apr/src/Recorder.cpp(+55/-0),core/libs/prx/libkernel/CMakeLists.txt(+1/-0),core/libs/tests/GuestAmpr.cpp(+52/-0).conventionspasses there and fails here (this PR left### What,### Tested,AI-assistedandDepends onunfilled), and it reportsCLEANagainst this one'sUNSTABLE.So #4244 already carries everything this PR would contribute. Closing this one to leave a single copy for review — #4244 is the copy to keep, and the title measurement it unblocks (Trails in the Sky 2nd Chapter, PPSA35169) is recorded there.
Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by overlordxrz-source on 2026-10-12T03:48:23Z.
@Dextroid17 thanks for tracking these down. One thing about the signature, before this merges:
On the console these two are the libkernel writers that libSceAmpr's AMM command buffer calls. They don't record into a
CommandBufferObject. drakmor/ampr_emu hooks them as:Its
AmmCommandBuffer(L327-L403) calls each writer twice. The first call passesdst = nullptrand reads the size fromoutSize. The second passesbuffer + offsetwithoutSize = nullptr, and then the caller advances its own offset. With theCommandBufferObject*form in this PR:EINVAL, because!bufferis truebase/size/offsetout of the title's raw buffer memory (offset 0x10 and so on), so it getsEPERMon a zeroed buffer, or writes to a pointer taken from command bytesTwo smaller points from the same source:
allocatePaForPrtfrom this same writer withprotMask = 1019(L376-L388). 1019 has bit 0x8 set, soValidProtectrejects it. Writing anAmmAllocatePaForPrtrecord for that mask keeps the existing executor path.I have a version along these lines with a submission test: the records are written into a plain byte buffer, compared byte-for-byte with the libSceAmpr recorder output, then submitted with
sceAmprAmmSubmitCommandBuffer3and their effects checked. If it helps, I can push it as a branch for you to take into this PR. That seems better than a competing PR.AI-assisted: yes
Pull request closed