Repository navigation
fix(libs): take the AMPR wait and counter signatures from ampr_emu - #579
Conversation
sceAmprCommandBufferWaitOnAddress took (address, reference, mask, compare) and WaitOnCounter (counter, reference, compare), and both read the compare value as WAIT_REG_MEM (0 always, 1 <, 2 <=, 3 ==, ...). ampr_emu, which replaces libSceAmpr for retail titles on the console, has (address, reference, compare, flush) and (counter, reference, compare, flush) with the SCE compare values (0 ==, 1 > unsigned, 2 < unsigned, 3 !=), so waits were decoded as other comparisons and could block forever or pass early. WriteAddressFromCounterPairOnCompletion takes one counter index, not two, and WriteKernelEventQueueOnCompletion an int id and no user data. Counter indices above 127, compare values above 3, flush values above 1 and misaligned wait addresses return EINVAL, as in ampr_emu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
As in ampr_emu, a counter pair starts at an even counter, and the write commands take a non-null, 8-byte aligned address; others return EINVAL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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 It also fixes a real misread on main: with the old signature the compare landed in 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. 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. |
…tures # Conflicts: # docs/dev/TechnicalDebt.md
|
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 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. |
What
@MichonGoddijn231849, this changes functions from 2b5f2d3. 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