fix(libSceAgc): accept a null base in sceAgcDcbSetBaseIndirectArgs #3239

Merged
Tamalero merged 1 commit from upstream-pr/3239 into main 2026-10-11 07:24:07 +00:00
Tamalero commented 2026-10-11 03:09:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-11T03:09:49Z.


What

sceAgcDcbSetBaseIndirectArgs throws null or misaligned address 0x0 when a title passes a null indirect base. Marvel's Guardians of the Galaxy (PPSA01748) stops on it during startup.

Cause: the builder calls CheckAddress, which rejects 0. The PM4 executor already accepts SET_BASE with address 0 (Pm4.cpp, opcode 0x11: only alignment and address bits are checked) and stores it. An indirect draw that later reads from the base is checked there.

Fix: a null base is accepted, the same as sceAgcDcbSetIndexBuffer already does to unbind (if (address != 0) CheckAddress(...)). A non-null base is still checked for 8-byte alignment.

Tested

Linux (CachyOS), GCC 16, Release, on current main.

  • agc_commands and agc_initialization pass. New testIndirectBase:
    • a bound base writes the address words;
    • a null base (compute flag) writes 0;
    • a misaligned base still throws without touching packet memory.
  • Negative check: the null case throws on the current builder.
  • PPSA01748 no longer stops on this call and runs until a later, unrelated stop.
  • tools/check_conventions.py passes.

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

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4816204206 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3239). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-11T03:09:49Z. --- ### What `sceAgcDcbSetBaseIndirectArgs` throws `null or misaligned address 0x0` when a title passes a null indirect base. Marvel's Guardians of the Galaxy (PPSA01748) stops on it during startup. **Cause:** the builder calls `CheckAddress`, which rejects 0. The PM4 executor already accepts `SET_BASE` with address 0 (`Pm4.cpp`, opcode `0x11`: only alignment and address bits are checked) and stores it. An indirect draw that later reads from the base is checked there. **Fix:** a null base is accepted, the same as `sceAgcDcbSetIndexBuffer` already does to unbind (`if (address != 0) CheckAddress(...)`). A non-null base is still checked for 8-byte alignment. ### Tested Linux (CachyOS), GCC 16, Release, on current `main`. - `agc_commands` and `agc_initialization` pass. New `testIndirectBase`: - a bound base writes the address words; - a null base (compute flag) writes 0; - a misaligned base still throws without touching packet memory. - Negative check: the null case throws on the current builder. - PPSA01748 no longer stops on this call and runs until a later, unrelated stop. - `tools/check_conventions.py` passes. ### 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 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-11 03:09:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T03:09:59Z.


Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6104898575 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3239#issuecomment-6104898575). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T03:09:59Z. --- Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
reyani-dev commented 2026-10-11 06:14:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-11T06:14:57Z.


Windows run, since the PR has only Linux results. Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7, Release, RTX 4070 Laptop GPU (driver 616.92), head 8d96b449 merged onto main 4be74d4f, with VK_LOADER_DRIVERS_DISABLE=*dzn* (#3255).

  • The build has no warnings.
  • agc_commands (including testIndirectBase) and agc_initialization pass.
  • ctest -R "^agc_|video_out|^shader|recompiler": 357/357 pass.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106152024 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3239#issuecomment-6106152024). Originally posted by [reyani-dev](https://github.com/reyani-dev) on 2026-10-11T06:14:57Z. --- Windows run, since the PR has only Linux results. Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7, Release, RTX 4070 Laptop GPU (driver 616.92), head `8d96b449` merged onto `main` `4be74d4f`, with `VK_LOADER_DRIVERS_DISABLE=*dzn*` (#3255). - The build has no warnings. - `agc_commands` (including `testIndirectBase`) and `agc_initialization` pass. - `ctest -R "^agc_|video_out|^shader|recompiler"`: 357/357 pass.
adriadam10 commented 2026-10-11 07:24:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T07:24:04Z.


Checked the null case against Pm4.cpp (SET_BASE already accepts address 0), KytyPS5 (no address validation) and the prosper console golden; agc_commands passes with the change and fails without it, libSceAgc ctest 20/20. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106646054 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3239#issuecomment-6106646054). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T07:24:04Z. --- Checked the null case against `Pm4.cpp` (SET_BASE already accepts address 0), KytyPS5 (no address validation) and the prosper console golden; `agc_commands` passes with the change and fails without it, libSceAgc ctest 20/20. Merging.
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!3239
No description provided.