feat(libSceAgc): implement sceAgcDcbSetIndexIndirectArgs #1998

Closed
ryyReid wants to merge 1 commit from upstream-pr/1998 into main
ryyReid commented 2026-10-09 04:26:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ryyReid on 2026-10-09T04:26:03Z.


What

Implements sceAgcDcbSetIndexIndirectArgs, which #1584 leaves unimplemented because of its declaration.

  • The declaration was (buf, dataOffsetInBytes). OpenAGC and SharpProspero both declare a 64-bit address followed by a 32-bit value, so it is now (buf, std::uint64_t address, std::uint32_t offset).
  • It writes the 4-dword packet 0xc0029100, address low, address high, offset (AGC-specific opcode 0x91), as OpenAGC does. The header encodes 3 payload dwords, which matches the 16-byte size both sources give.
  • OpenAGC masks the address to 16 bytes and the offset to 16 bits. Here a null or misaligned address, or a wider offset, throws instead.
  • The driver does not execute opcode 0x91, as no source says what the GPU reads through it; a submitted packet still throws ("opcode is not known in the reference"). This follows the sceAgcDcbSetCfRegisterDirect precedent (8ab5fab8). Recorded in TechnicalDebt, including that SharpProspero names the third argument an index count.

The GetSize export is left to #1584.

Tested

Windows 11, WinLibs GCC 15.2.0 r7 (x86_64-ucrt-posix-seh):

  • agc_commands: new testIndexIndirectArgs checks the packet words, the cursor, and that a null address, a misaligned address, an offset above 16 bits and a null command buffer throw without touching the buffer.
  • Full ctest: 488/488.
  • tools/check_conventions.py --base origin/main passes.

No title was tested; none I have calls this export.

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 (#1584 changes the GetSize export in the same file; the two branches merge cleanly in either order)
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4795961980 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1998). Originally posted by [ryyReid](https://github.com/ryyReid) on 2026-10-09T04:26:03Z. --- ### What Implements `sceAgcDcbSetIndexIndirectArgs`, which #1584 leaves unimplemented because of its declaration. - The declaration was `(buf, dataOffsetInBytes)`. [OpenAGC](https://github.com/OpenAGC/OpenAGC/blob/main/src/game_compat.c) and [SharpProspero](https://github.com/SvenGDK/SharpProspero/blob/main/src/SharpProspero/Interop/Agc/SceAgc.cs) both declare a 64-bit address followed by a 32-bit value, so it is now `(buf, std::uint64_t address, std::uint32_t offset)`. - It writes the 4-dword packet `0xc0029100, address low, address high, offset` (AGC-specific opcode 0x91), as OpenAGC does. The header encodes 3 payload dwords, which matches the 16-byte size both sources give. - OpenAGC masks the address to 16 bytes and the offset to 16 bits. Here a null or misaligned address, or a wider offset, throws instead. - The driver does not execute opcode 0x91, as no source says what the GPU reads through it; a submitted packet still throws ("opcode is not known in the reference"). This follows the `sceAgcDcbSetCfRegisterDirect` precedent (8ab5fab8). Recorded in TechnicalDebt, including that SharpProspero names the third argument an index count. The GetSize export is left to #1584. ### Tested Windows 11, WinLibs GCC 15.2.0 r7 (`x86_64-ucrt-posix-seh`): - `agc_commands`: new `testIndexIndirectArgs` checks the packet words, the cursor, and that a null address, a misaligned address, an offset above 16 bits and a null command buffer throw without touching the buffer. - Full `ctest`: 488/488. - `tools/check_conventions.py --base origin/main` passes. No title was tested; none I have calls this export. ### 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 (#1584 changes the GetSize export in the same file; the two branches merge cleanly in either order) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-09 04:38:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T04:38:28Z.


I reviewed the complete three-file diff against the cited OpenAGC implementation. The packet header and three payload dwords match; the null/alignment and 16-bit checks follow the project command helpers. I also built and ran agc_commands on Linux (pass), and tools/check_conventions.py --base upstream/main passes. The PR still has no upstream checks attached, so I am holding formal approval until the standard Build and Conventions checks report on this head. The local test-registration script could not run because this environment has no ninja executable; CTest does list agc_commands.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6074371610 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1998#issuecomment-6074371610). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-09T04:38:28Z. --- I reviewed the complete three-file diff against the cited OpenAGC implementation. The packet header and three payload dwords match; the null/alignment and 16-bit checks follow the project command helpers. I also built and ran `agc_commands` on Linux (pass), and `tools/check_conventions.py --base upstream/main` passes. The PR still has no upstream checks attached, so I am holding formal approval until the standard Build and Conventions checks report on this head. The local test-registration script could not run because this environment has no `ninja` executable; CTest does list `agc_commands`.
MarcZX10 commented 2026-10-09 04:55:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T04:55:11Z.


Follow-up to my earlier review: I installed Ninja in a temporary environment and ran the exact CI registration check on head fd89ead1. It passes: 439 test executables, only the three already recorded as built and not run, none new. The earlier local agc_commands run and conventions check also pass. Upstream still has no checks attached to this head, so formal approval remains pending the maintainer-approved Build and Conventions workflows.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6074543240 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1998#issuecomment-6074543240). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-09T04:55:11Z. --- Follow-up to my earlier review: I installed Ninja in a temporary environment and ran the exact CI registration check on head `fd89ead1`. It passes: 439 test executables, only the three already recorded as built and not run, none new. The earlier local `agc_commands` run and conventions check also pass. Upstream still has no checks attached to this head, so formal approval remains pending the maintainer-approved Build and Conventions workflows.
MarcZX10 commented 2026-10-09 05:04:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T05:04:13Z.


Additional verification on exact head fd89ead1: a fresh Release build of agc_command_tests completed, ctest -R ^agc_commands$ passed (1/1, 0.02 s), and the conventions and diff checks pass. The CTest registration check also passes (439 executables; no unrecorded tests). The only missing evidence is upstream Build/Conventions CI, which remains unattached because the runs require maintainer approval.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6074650757 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1998#issuecomment-6074650757). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-09T05:04:13Z. --- Additional verification on exact head `fd89ead1`: a fresh Release build of `agc_command_tests` completed, `ctest -R ^agc_commands$` passed (1/1, 0.02 s), and the conventions and diff checks pass. The CTest registration check also passes (439 executables; no unrecorded tests). The only missing evidence is upstream Build/Conventions CI, which remains unattached because the runs require maintainer approval.
oneandonlydean commented 2026-10-09 08:53:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T08:53:23Z.


Closing: no title is shown to call sceAgcDcbSetIndexIndirectArgs on main, and library functions go in when one does. Please reopen with the title ID and the log line if you find one.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6077685752 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1998#issuecomment-6077685752). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-09T08:53:23Z. --- Closing: no title is shown to call `sceAgcDcbSetIndexIndirectArgs` on main, and library functions go in when one does. Please reopen with the title ID and the log line if you find one.

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!1998
No description provided.