feat(agc): write the measured sceAgcDcbSetIndexIndirectArgs packet #4392

Closed
soufian3hm wants to merge 1 commit from upstream-pr/4392 into main
soufian3hm commented 2026-10-12 08:54:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by soufian3hm on 2026-10-12T08:54:41Z.


What

sceAgcDcbSetIndexIndirectArgs and sceAgcDcbSetIndexIndirectArgsGetSize threw NotImplemented. They now write the 4-dword INDEX_ATTRIBUTES_INDIRECT (0x91) packet that the console's libSceAgc.sprx writes, and the size function returns 16.

dword value
0 0xc0029100
1 attribute base, low 4 bits cleared
2 attribute base, high half
3 attribute index masked to 16 bits

Sources:

  • PS5 console measurement, prosper's console oracle: three vectors for the packet, and GetSize = 0x10. Vector c shows the base is 64-bit (its high half lands in dword 2) and the masks: 0x1111111122222222, 0x3333333344444444 gives c0029100 22222220 11111111 00004444.
  • OpenAGC has the same signature (cb, uint64 address, uint32 offset) and the same masks; SharpProspero declares (cb, indexAddr, uint) and size 0x10.
  • Field names from PAL's PM4_PFP_INDEX_ATTRIBUTES_INDIRECT: indirect_mode (bit 0) and 3 reserved bits under attribute_base_lo, attribute_base_hi, 16-bit attribute_index.

The previous stub's (buf, dataOffsetInBytes) signature had no source; the measurement contradicts it.

The console masks the base and index silently and the measured vectors are pinned word for word, so this follows the measurement rather than throwing on low base bits as sceAgcDcbSetIndexBuffer does.

PPSA07286 imports both NIDs (0o3VDdtA6nM, AFIh8SQkYlQ), as listed in #2591. The driver has no handler for opcode 0x91, so a submitted packet still throws (opcode is not known in the reference); this is recorded in TechnicalDebt, as for ATOMIC_GDS in #3756.

Library progress: 3018 -> 3020 of 3487.

Tested

Windows 11, WinLibs GCC 15.2.0 r7, Release. agc_commands pins the three console vectors word for word, the returned address, the four-word cursor advance, no write outside the packet, failure without writes on an exhausted buffer, failure on a null buffer, and the size. agc_commands and agc_initialization pass; python3 tools/check_conventions.py --base origin/main passes. Not tested with a title.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4827107525 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4392). Originally posted by [soufian3hm](https://github.com/soufian3hm) on 2026-10-12T08:54:41Z. --- ### What `sceAgcDcbSetIndexIndirectArgs` and `sceAgcDcbSetIndexIndirectArgsGetSize` threw `NotImplemented`. They now write the 4-dword INDEX_ATTRIBUTES_INDIRECT (0x91) packet that the console's `libSceAgc.sprx` writes, and the size function returns 16. | dword | value | | --- | --- | | 0 | `0xc0029100` | | 1 | attribute base, low 4 bits cleared | | 2 | attribute base, high half | | 3 | attribute index masked to 16 bits | Sources: - PS5 console measurement, [prosper's console oracle](https://github.com/mattias800/prosper/blob/59686bcd579e476df7300744ba416f835ae044d4/prosper/tests/data/console_oracle/agcbuild.golden.tsv#L172-L174): three vectors for the packet, and [`GetSize` = 0x10](https://github.com/mattias800/prosper/blob/59686bcd579e476df7300744ba416f835ae044d4/prosper/tests/data/console_oracle/agc.golden.tsv#L67). Vector c shows the base is 64-bit (its high half lands in dword 2) and the masks: `0x1111111122222222, 0x3333333344444444` gives `c0029100 22222220 11111111 00004444`. - [OpenAGC](https://github.com/OpenAGC/OpenAGC/blob/3c7e8072f0d7684e930454794fd5c02056946d73/src/game_compat.c#L1742-L1757) has the same signature `(cb, uint64 address, uint32 offset)` and the same masks; [SharpProspero](https://github.com/SvenGDK/SharpProspero/blob/5dfdb4b0b166e83dc9ae275001afb695f12c7174/src/SharpProspero/Interop/Agc/SceAgc.cs#L546-L550) declares `(cb, indexAddr, uint)` and size 0x10. - Field names from PAL's [`PM4_PFP_INDEX_ATTRIBUTES_INDIRECT`](https://github.com/GPUOpen-Drivers/pal/blob/c5e800072a32f68b6ccc4422936d96167c6e0728/src/core/hw/gfxip/gfx9/chip/gfx9_plus_merged_f32_pfp_pm4_packets.h#L2441-L2483): `indirect_mode` (bit 0) and 3 reserved bits under `attribute_base_lo`, `attribute_base_hi`, 16-bit `attribute_index`. The previous stub's `(buf, dataOffsetInBytes)` signature had no source; the measurement contradicts it. The console masks the base and index silently and the measured vectors are pinned word for word, so this follows the measurement rather than throwing on low base bits as `sceAgcDcbSetIndexBuffer` does. PPSA07286 imports both NIDs (`0o3VDdtA6nM`, `AFIh8SQkYlQ`), as listed in #2591. The driver has no handler for opcode 0x91, so a submitted packet still throws (`opcode is not known in the reference`); this is recorded in TechnicalDebt, as for ATOMIC_GDS in #3756. Library progress: 3018 -> 3020 of 3487. ### Tested Windows 11, WinLibs GCC 15.2.0 r7, Release. `agc_commands` pins the three console vectors word for word, the returned address, the four-word cursor advance, no write outside the packet, failure without writes on an exhausted buffer, failure on a null buffer, and the size. `agc_commands` and `agc_initialization` pass; `python3 tools/check_conventions.py --base origin/main` passes. Not tested with a title. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
oneandonlydean commented 2026-10-13 00:21:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T00:21:54Z.


Closing: no title is shown calling sceAgcDcbSetIndexIndirectArgs (PPSA07286 imports it, nothing was run), and one that did would still stop on submit, since the driver has no handler for opcode 0x91. The measured vectors are the right basis; reopen with the title ID and the log line when one stops here on main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135193699 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4392#issuecomment-6135193699). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T00:21:54Z. --- Closing: no title is shown calling `sceAgcDcbSetIndexIndirectArgs` (PPSA07286 imports it, nothing was run), and one that did would still stop on submit, since the driver has no handler for opcode 0x91. The measured vectors are the right basis; reopen with the title ID and the log line when one stops here on main.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!4392
No description provided.