feat(ampr): implement the command buffer markers #538
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/538"
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 DotDebian on 2026-10-04T16:10:56Z.
What
Implements the AMPR command buffer markers, which threw
not implemented:sceAmprCommandBufferPushMarker,PushMarkerWithColor,PopMarker,SetMarker,SetMarkerWithColorappend a marker command (header, then the NUL-terminated text padded to 8 bytes; pop is the header alone).sceAmprMeasureCommandSizePushMarker,PushMarkerWithColor,PopMarker,SetMarker,SetMarkerWithColorreturn the size the matching call appends.A null text, a null buffer object and a null color pointer return
SCE_KERNEL_ERROR_EINVAL; the measure functions return it zero-extended. A buffer without room returns the error the other commands of this file already return, and leaves the offset and command count untouched.Source for the signatures and the argument checks: the ampr_emu reimplementation of libSceAmpr (
src/sceampr_exports.cpp,src/ampr_emu_command_buffer.cpp, commit cfa85df). No code is taken from it: the command encoding here is AnyPS5's own, asAprCommandBuffer.hppstates.Limits, recorded in TechnicalDebt:
sceAmprCommandBufferSetMarkerWithColortakes the color by pointer while the push and measure variants take it by value; the pointer is checked for null but not read.Not in this PR:
sceAmprCommandBufferConstructMarker, the nop functions and the_04_00variants stay unimplemented. A marker is one command here whatever its length; on the console a text longer than 60 bytes spans several records.The test needed a
CMakeLists.txtfor libSceAmpr; the library is built as before.Tested
Windows 11, MinGW-w64 GCC 15.2.0,
ctest: 184/184 pass. New testguest_ampr_markers(core/libs/tests/GuestAmpr.cpp): each call advances the offset by the measured size and adds one command, the recorded text is intact, the rejected arguments and the full buffer leave the buffer unchanged, andsceKernelAprSubmitCommandBufferruns a buffer that mixes markers withWriteAddresscommands. The test fails onmainwithsceAmprCommandBufferPushMarker not implemented.No title was run.
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)Export.cpp; the two merge cleanly)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-04T16:11:18Z.
Progress report (
2cf901b→638d380)📈 System libraries: 77.66% (+0.31%, +10 implemented functions)
✅ 10 implemented
sceAmprCommandBufferPopMarkersceAmprCommandBufferPushMarkersceAmprCommandBufferPushMarkerWithColorsceAmprCommandBufferSetMarkersceAmprCommandBufferSetMarkerWithColorsceAmprMeasureCommandSizePopMarkersceAmprMeasureCommandSizePushMarkersceAmprMeasureCommandSizePushMarkerWithColorsceAmprMeasureCommandSizeSetMarkersceAmprMeasureCommandSizeSetMarkerWithColorImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T21:19:17Z.
Thanks. The measure functions return exactly what the append functions write, a full buffer leaves the offset and command count alone, and the executor skips the three opcodes like a nop. The new
CMakeLists.txtbuilds the library the same way the generic rule incore/libs/CMakeLists.txtdid.About the TechnicalDebt line: PPSA21564 confirms the signatures. It imports these markers, and its wrapper for
sceAmprCommandBufferSetMarkerWithColor(eboot offset 0x1d9e0) gets the color inedx, stores it on the stack, and passes a pointer to it inrdx. ThePushMarkerWithColor,PushMarkerandPopMarkerwrappers are plain tail jumps, so the color goes by value there. That matches ampr_emu. You could change the line to say the signatures are confirmed and only the colors are dropped, but that's optional. Ready to merge from my side.