Skip to content

fix(libSceAgc): encode jumps as the console does - #19320

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
angrysandhill:fix/agc-jump-console-args
Nov 16, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
angrysandhill:fix/agc-jump-console-args

Conversation

@angrysandhill

Copy link
Copy Markdown
Contributor

What

sceAgcDcbJump and sceAgcAcbJump differ from the console in two ways. Both are measured in prosper's console measurements (agcbuild_{Acb,Dcb}Jump_a/b/c).

1. Arguments the console accepts:

  • AnyPS5 throws for a mode above 1, a cache policy above 3, a size above 0xfffff, or a target that is not 4-byte aligned.
  • The console masks them instead:
    • mode: bit 0;
    • cache policy: low two bits;
    • size: low 20 bits;
    • target: low two bits cleared. 0x33333333 → 0x33333330, while 0x44444444 keeps bit 2, so the mask is exactly two bits.
  • A null target is written as 0.

2. The ACB control word:

  • Every ACB jump the console wrote sets bit 23 of the INDIRECT_BUFFER control word, not bit 21: 0x1f933333, 0x1f900003 and 0x2f900000.
  • The DCB jumps keep bit 21: 0x2f344444, 0x2f300004 and 0x0f200000.
  • AnyPS5 wrote bit 21 for both, so every ACB jump differed from the console, valid arguments included.
  • WriteJump now takes a compute flag, as WriteWait does.
  • Neither bit is read by the driver: Submission.cpp takes only the target, size and chain bit. Nor is either read by the jump patch functions. So execution is unchanged.

Valid DCB arguments still produce the same packets. All six rows now match the console and are removed from known.tsv.

Not changed:

  • sceAgcJumpPatchSetTarget and sceAgcJumpPatchSetTarget_0300 still refuse those values. Patch functions are not in the measurements.
  • A new debt entry records the bit-23 rule and its source.

Sources: the rows above, from prosper's pinned console measurements, SHA-256 aa6cc7b818a1016c20732e4547cea8c12b0472aec681bcf11f8f9a3c897f7de3, checked by library_oracle.py.

Tests, in testFlowPackets (tests/Commands.cpp):

  • The four expectFailure cases for those arguments are replaced by the six console cases, word for word.
  • The existing ACB jump expectation changes from 0x1f300010 to 0x1f900010.

Tested

Windows 10 22H2, AMD Radeon RX 6750 XT (gfx1031), Adrenalin 26.10.1 (driver 32.0.21045.16010), WinLibs GCC 15.2, Release. Main a6606d5bab, change e8d6d0c773.

  • Replay of the pinned agcbuild measurements, same replay executable throughout:
    • main: 92 compared, 156 known findings;
    • this change with main's known.tsv: 98 compared, 0 new, and exactly the six Jump rows reported as now matching;
    • this change with the updated known.tsv: 150 known findings, 0 new, 0 now matching.
  • Tests: ctest -R '^(agc_commands|agc_driver_pm4|agc_driver_job_manager_compute|agc_driver_queued_index_read_order|agc_driver_queued_indirect_read_order|agc_driver_frame_replay.*)$' passes 48/48.
    • The agc_driver_frame_replay* tests submit DCB jump chains built by sceAgcDcbJump and follow them through Submission.cpp.
    • agc_driver_pm4 covers the driver's INDIRECT_BUFFER decoding.
    • Four GPU tests also pass under VK_LAYER_KHRONOS_validation 1.4.367, with 0 VUID- lines and no missing-layer warnings.
    • No GPU test builds an ACB jump through sceAgcAcbJump.
  • Negative control: with only the new tests applied to main, agc_commands fails with compute jumps did not chain, the bit-23 control word.
  • Overlap:
  • Linux was not tested.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 6750 XT (gfx1031), Adrenalin 26.10.1, Windows 10 22H2. The GPU tests ran as a regression check under the validation layer; the packet tests are CPU-only.
  • AI-assisted: yes

🤖 Generated with Claude Code

The jump builders now mask the mode, cache policy, size and target as
prosper's console measurements show instead of refusing them, and an ACB
jump sets bit 23 of the INDIRECT_BUFFER control word where a DCB jump sets
bit 21, which every measured ACB jump does. Six oracle rows now match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added docs agc libSceAgc* labels Nov 13, 2026
@JJenkx

JJenkx commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Windows check of head e8d6d0c773, merged onto main b00dc5a6b7. Setup: Windows 11 Enterprise 22621, AMD RX 6700 XT, AMD driver 26.10.1, MinGW-w64 GCC 15.2 UCRT, Release.

agc_commands and agc_initialization passed in 3 of 3 runs in both setups:

  • GPU, through the shared Windows GPU FIFO with ANYPS5_REQUIRE_VULKAN=1 (merge 7dcd4aa6ef): 6 of 6 outcomes. The binaries matched the hashes recorded at preparation, and the receipt shows exit 0 and app_count=0.
  • CPU, Vulkan hidden (merge 65aa61fbe9).

AI-assisted: yes.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

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.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 20405 tools/library-oracle/known.tsv L22-27, L89-94

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 17742 docs/dev/debt/libSceAgc.md

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@oneandonlydean
oneandonlydean merged commit 706cfec into boykopovar:main Nov 16, 2026
16 checks passed
@angrysandhill
angrysandhill deleted the fix/agc-jump-console-args branch November 22, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants