fix(libs): take the AMPR wait and counter signatures from ampr_emu #579
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/579"
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 CnRJay on 2026-10-04T23:25:47Z.
What
@MichonGoddijn231849, this changes functions from
2b5f2d32. Please check against anything you have from a title.Several AMPR command buffer exports had signatures and argument meanings that differ from ampr_emu. ampr_emu replaces
libSceAmpron the console for retail titles, and TechnicalDebt already cites it for the marker signatures. Signatures and enum values only are taken from it; no code was copied (it is GPL-3.0).sceAmprCommandBufferWaitOnAddress(address, reference, mask, compare)(address, reference, compare, flush)sceAmprCommandBufferWaitOnCounter(counter, reference, compare)(counter, reference, compare, flush)sceAmprCommandBufferWriteAddressFromCounterPairOnCompletion(address, counter0, counter1)(address, counter)sceAmprCommandBufferWriteKernelEventQueueOnCompletion(equeue, ident, data, userData)(equeue, int id, data)The executor read the compare value with the WAIT_REG_MEM meaning (0 always, 1 <, 2 <=, 3 ==, 4 !=, 5 >=, 6 >), which TechnicalDebt marked as assumed. It now uses the SCE values:
0==,1> unsigned,2< unsigned,3!=;4>= wrapped,5> signed and6< signed are also handled, for the_04_00exports.With the old reading, a game waiting for
value > ref(1) waited forvalue < ref, and one waiting for!=(3) waited for==.Validation follows ampr_emu: counter index > 127, compare > 3, flush > 1, a misaligned wait address, a null or misaligned write address, an odd counter-pair start, or a null event queue return
EINVAL. The flush is accepted and has no effect, since commands run in order. ampr_emu notes that the console accepts only even counter-pair starts, so the pair of counternis countersnandn + 1. Which one forms the low 32 bits is not stated, so counternis assumed to be the low half, as before; the TechnicalDebt entry says so.Tested
Windows 11, MinGW GCC 15.2.0 r7.
guest_ampr_markers(core/libs/tests/GuestAmpr.cpp) gains three tests:Full
ctest: 216/217 pass.agc_shader_memoryfails without this change too; #574 fixes it.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 oneandonlydean on 2026-10-04T23:44:09Z.
Thanks, this is a useful fix. I checked every changed signature against ampr_emu (src/sceampr_exports.cpp at cfa85df3) and they match, including the
uint8_tcounter indexes and theint32_tevent id. The compare values matchinclude/ampr.h(0 ==, 1 > unsigned, 2 < unsigned, 3 !=, then 4 to 6 for the versioned forms), and the wrapped and signed evaluations give the same results as ampr_emu's reactor. The argument checks follow its validators too: compare below 4, flush below 2, a 7-bit counter,(index & 0x81) == 0for a pair, an aligned wait address, and a non-null aligned write address.It also fixes a real misread on main: with the old signature the compare landed in
maskand the flush incompare, so a wait with flush 0 never waited. The event id is sign extended the same waysceKernelAddUserEventstores it, so the triggered event still matches.PPSA21564 doesn't import any of the non-versioned exports changed here, and the versioned waits it does import still throw on main, so this doesn't change anything in my runs.
guest_ampr_markerscovers the new rows: it passes here (with #580 on top), and with main's code it waits until its 10 s deadline and aborts, which is the misread above.The CI run still needs approval. Once it's green, this is ready to merge from my side. TechnicalDebt.md conflicts with #516, #518 and #553 (same lines), so whichever lands later needs a one-line rebase.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T00:15:43Z.
Thanks for merging main in. The code is the same as the head I reviewed, and the TechnicalDebt.md resolution is right: it keeps main's
sceRtcParseDateTimeline and replaces the old WAIT_REG_MEM line with yours.guest_ampr_markerspasses here on this head on its own (without #580).The new push needs workflow approval again before CI runs. Ready to merge from my side once it's green. #518 and #553 still touch the same TechnicalDebt.md lines, so whichever of those lands after this one needs a one-line rebase.