libs: implement 14 Agc GetSize entry points GTA V imports #2441

Open
github-bot wants to merge 3 commits from github-bot/gh-2441 into main AGit
Owner

@⁠Moonwolf711 on GitHub · 2026-11-20 06:25 UTC · original
Moonwolf711:agc-getsize → main · +215 −0 · 3 files · 3 commits · open

GTA V (PPSA04263/04264) imports a set of sceAgc* functions that are not registered, so the runtime linker patches them to the unresolved-import stub returning 0. A game calling one of the *GetSize functions to reserve command-buffer space gets a zero-sized reservation while the corresponding builder writes a full packet.

All NID/name pairs in this PR are hash-verified with the PS5 NID scheme (SHA-1 + 16-byte suffix, reversed digest, custom base64), cross-checked against AnyPS5's headers and hardware-derived packet sizes.

Batch 1 — GetSize entry points whose builders exist in-tree (sizes = builder AllocateDW x 4 bytes):

  • sceAgcAcbEventWriteGetSize (2 dw), sceAgcAcbDmaDataGetSize (7 dw), sceAgcAcbRewindGetSize (delegates to AgcDcbRewindGetSize), sceAgcAcbDispatchIndirectGetSize (4 dw)
  • sceAgcDcbSetShRegisterDirectGetSize / SetUcRegisterDirectGetSize (3 dw), sceAgcDcbSetIndexSizeGetSize (3 dw), sceAgcDcbSetIndexBufferGetSize (3 dw), sceAgcDcbSetIndexCountGetSize (2 dw), sceAgcDcbDrawIndexIndirectGetSize (5 dw), sceAgcDcbDrawIndirectMultiGetSize (16 dw), sceAgcDcbDrawIndexIndirectMultiGetSize (10 dw), sceAgcDcbGetLodStatsGetSize (5 dw), sceAgcDcbStallCommandBufferParserGetSize (2 dw)

Batch 2 — sync/atomic imports:

  • sceAgcAcbSetWorkloadsActive / sceAgcAcbSetWorkloadComplete: delegate to the existing Dcb builders (same 18/12-word packets, signatures confirmed against AnyPS5)
  • sceAgcDcbMemSemaphore (G0jrLdvEqDw): delegates to AcbMemSemaphore
  • sceAgc{Acb,Dcb}AtomicMemGetSize = 36, sceAgc{Acb,Dcb}AtomicGdsGetSize = 44, sceAgcAcbPrimeUtcl2GetSize = 20 (sizes from AnyPS5's hardware-verified implementations)

Batch 3 — PrimeUtcl2 builders:

  • sceAgcAcbPrimeUtcl2 (szG7hz2yEhA) and sceAgcDcbPrimeUtcl2 (jt3pl7EN17o): 5-word NOP-payload packets matching AnyPS5's layout and the 20-byte GetSize. An earlier draft of this PR mapped jt3pl7EN17o to DcbMemSemaphore — NID hash verification corrected that.

Import lists cross-checked against the unresolved-import logs attached to #2277 and #810.

Not covered (no in-tree builder or authoritative size yet): AtomicMem/AtomicGds builders, CbCondWrite, CbMemsetExclusive, SetIndexIndirectArgs, occlusion queries, submit-validation/capture driver APIs.

Verified: full Windows build (clang-cl) and shader_cfg_tests pass.

**@⁠Moonwolf711** on GitHub · 2026-11-20 06:25 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2441) `Moonwolf711:agc-getsize` → `main` · +215 −0 · 3 files · 3 commits · open GTA V (PPSA04263/04264) imports a set of `sceAgc*` functions that are not registered, so the runtime linker patches them to the unresolved-import stub returning 0. A game calling one of the `*GetSize` functions to reserve command-buffer space gets a zero-sized reservation while the corresponding builder writes a full packet. All NID/name pairs in this PR are hash-verified with the PS5 NID scheme (SHA-1 + 16-byte suffix, reversed digest, custom base64), cross-checked against AnyPS5's headers and hardware-derived packet sizes. **Batch 1 — GetSize entry points whose builders exist in-tree** (sizes = builder `AllocateDW` x 4 bytes): - `sceAgcAcbEventWriteGetSize` (2 dw), `sceAgcAcbDmaDataGetSize` (7 dw), `sceAgcAcbRewindGetSize` (delegates to `AgcDcbRewindGetSize`), `sceAgcAcbDispatchIndirectGetSize` (4 dw) - `sceAgcDcbSetShRegisterDirectGetSize` / `SetUcRegisterDirectGetSize` (3 dw), `sceAgcDcbSetIndexSizeGetSize` (3 dw), `sceAgcDcbSetIndexBufferGetSize` (3 dw), `sceAgcDcbSetIndexCountGetSize` (2 dw), `sceAgcDcbDrawIndexIndirectGetSize` (5 dw), `sceAgcDcbDrawIndirectMultiGetSize` (16 dw), `sceAgcDcbDrawIndexIndirectMultiGetSize` (10 dw), `sceAgcDcbGetLodStatsGetSize` (5 dw), `sceAgcDcbStallCommandBufferParserGetSize` (2 dw) **Batch 2 — sync/atomic imports**: - `sceAgcAcbSetWorkloadsActive` / `sceAgcAcbSetWorkloadComplete`: delegate to the existing Dcb builders (same 18/12-word packets, signatures confirmed against AnyPS5) - `sceAgcDcbMemSemaphore` (`G0jrLdvEqDw`): delegates to `AcbMemSemaphore` - `sceAgc{Acb,Dcb}AtomicMemGetSize` = 36, `sceAgc{Acb,Dcb}AtomicGdsGetSize` = 44, `sceAgcAcbPrimeUtcl2GetSize` = 20 (sizes from AnyPS5's hardware-verified implementations) **Batch 3 — PrimeUtcl2 builders**: - `sceAgcAcbPrimeUtcl2` (`szG7hz2yEhA`) and `sceAgcDcbPrimeUtcl2` (`jt3pl7EN17o`): 5-word NOP-payload packets matching AnyPS5's layout and the 20-byte GetSize. An earlier draft of this PR mapped `jt3pl7EN17o` to DcbMemSemaphore — NID hash verification corrected that. Import lists cross-checked against the unresolved-import logs attached to #2277 and #810. Not covered (no in-tree builder or authoritative size yet): AtomicMem/AtomicGds builders, CbCondWrite, CbMemsetExclusive, SetIndexIndirectArgs, occlusion queries, submit-validation/capture driver APIs. Verified: full Windows build (clang-cl) and `shader_cfg_tests` pass.
Register zero-argument sceAgc*GetSize functions for packets whose
builders already exist: Acb EventWrite/DmaData/Rewind/DispatchIndirect,
Dcb SetShRegisterDirect/SetUcRegisterDirect/SetIndexSize/SetIndexBuffer/
SetIndexCount/DrawIndexIndirect/DrawIndirectMulti/DrawIndexIndirectMulti/
GetLodStats/StallCommandBufferParser. Sizes are derived from each
builder's AllocateDW count (dwords * 4 bytes). Without these, the
runtime linker patches unresolved imports to a stub returning 0, so a
game reserving command-buffer space gets a zero-sized reservation while
the builder writes a full packet.
Add Acb workload builders (SetWorkloadsActive/SetWorkloadComplete,
delegating to the existing Dcb builders, which emit the same 18/12-word
packets) and DcbMemSemaphore (delegating to AcbMemSemaphore). Register
zero-argument GetSize entry points sourced from AnyPS5's hardware-verified
implementations: AtomicMem 36, AtomicGds 44, PrimeUtcl2 20 bytes.
NID hash verification (AnyPS5 NidCompute scheme) showed jt3pl7EN17o is
sceAgcDcbPrimeUtcl2, not sceAgcDcbMemSemaphore (which hashes to
G0jrLdvEqDw). Register sceAgcAcbPrimeUtcl2 (szG7hz2yEhA) and
sceAgcDcbPrimeUtcl2 (jt3pl7EN17o) as 5-word NOP-payload packets matching
AnyPS5's layout and the 20-byte GetSize, and keep sceAgcDcbMemSemaphore
registered under its correct NID G0jrLdvEqDw.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:20:30 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-20 06:26 UTC · original · edited 2026-11-20 06:28 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T06:28:26.208185Z f60ddd5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-20 06:26 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2441#issuecomment-7032247881) · edited 2026-11-20 06:28 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"f60ddd5e8e63d7dcb00d5f1f8be959c376ed947f","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-20T06:28:26.208185Z">2026-11-20T06:28:26.208185Z</relative-time> | `f60ddd5` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-20 06:30 UTC · original · edited 2026-11-20 08:00 UTC

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Gen5 API adds ACB workload operations, ACB and DCB UTCL2 priming operations, and a DCB memory-semaphore operation. It adds packet-size queries for selected ACB and DCB commands. The query implementations return sizes in bytes, and the ACB rewind query returns the DCB rewind size. The Graphics5 symbol table registers the added operations and size queries.

Suggested reviewers: nmzik, opcod3

Change: Bug fix

Merge Risk: Minimal · up to ccb29

This change registers the missing AGC size queries and the PrimeUtcl2 and semaphore entry points, so imports no longer resolve to a stub that returns 0. No concrete defect was found in the changed code, and the DCB semaphore concern was ruled out by source inspection. The change is ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: registering 14 sceAgc*GetSize entry points that GTA V imports. The changeset adds these GetSize registrations and wrappers in agc.cpp, agc.h and libAgcDriver.cpp. The …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description states that GTA V imports unregistered sceAgc*GetSize functions, which return 0 from the unresolved-import stub. It lists the three batches of added GetSize entry points, PrimeUtcl2 bu…
Full details: Title check

Explanation

The title names the main change: registering 14 sceAgc*GetSize entry points that GTA V imports. The changeset adds these GetSize registrations and wrappers in agc.cpp, agc.h and libAgcDriver.cpp. The title says 14 entry points, but the changeset and description list more GetSize functions than that count, so the count is not exact. The core subject still matches the change.

Full details: Description check

Explanation

The description states that GTA V imports unregistered sceAgc*GetSize functions, which return 0 from the unresolved-import stub. It lists the three batches of added GetSize entry points, PrimeUtcl2 builders, and sync/atomic wrappers. It also gives NID verification, cross-checks against unresolved-import logs, the build and test results, and the items left uncovered. This matches the changeset, which adds these functions in agc.cpp, agc.h, and libAgcDriver.cpp.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between de5a949442 and ccb29c3671.

Files selected for processing: 3

  • src/libs/agc.cpp
  • src/libs/agc.h
  • src/libs/libAgcDriver.cpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-11-20 06:30 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2441#issuecomment-7032322493) · edited 2026-11-20 08:00 UTC <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/2441?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- recent_review_status_start --> No actionable comments were generated in the recent review. <!-- recent_review_status_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> <br> The Gen5 API adds ACB workload operations, ACB and DCB UTCL2 priming operations, and a DCB memory-semaphore operation. It adds packet-size queries for selected ACB and DCB commands. The query implementations return sizes in bytes, and the ACB rewind query returns the DCB rewind size. The Graphics5 symbol table registers the added operations and size queries. **Suggested reviewers:** `nmzik`, `opcod3` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_commit:"ccb29c3671fdd6696230271550cf04ed7462dc35" --> <!-- change_assessment_priority:{"version":1,"urgency":"p2","manual":false} --> **Change:** Bug fix <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>ccb29</code></summary> <dl> <dd> <br> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `ccb29` --> <!-- final_review_risk_coverage:{"sourceCommitId":"ccb29c3671fdd6696230271550cf04ed7462dc35","coveredCommitId":"ccb29c3671fdd6696230271550cf04ed7462dc35","kind":"reviewed"} --> This change registers the missing AGC size queries and the PrimeUtcl2 and semaphore entry points, so imports no longer resolve to a stub that returns 0. No concrete defect was found in the changed code, and the DCB semaphore concern was ruled out by source inspection. The change is ready to merge. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4</strong></summary> <dl> <dd> <br> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title names the main change: registering 14 sceAgc*GetSize entry points that GTA V imports. The changeset adds these GetSize registrations and wrappers in agc.cpp, agc.h and libAgcDriver.cpp. The … | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description states that GTA V imports unregistered sceAgc*GetSize functions, which return 0 from the unresolved-import stub. It lists the three batches of added GetSize entry points, PrimeUtcl2 bu… | <details> <summary><strong>Full details: Title check</strong></summary> <dl> <dd> <br> **Explanation** The title names the main change: registering 14 sceAgc*GetSize entry points that GTA V imports. The changeset adds these GetSize registrations and wrappers in agc.cpp, agc.h and libAgcDriver.cpp. The title says 14 entry points, but the changeset and description list more GetSize functions than that count, so the count is not exact. The core subject still matches the change. </dd> </dl> </details> <details> <summary><strong>Full details: Description check</strong></summary> <dl> <dd> <br> **Explanation** The description states that GTA V imports unregistered sceAgc*GetSize functions, which return 0 from the unresolved-import stub. It lists the three batches of added GetSize entry points, PrimeUtcl2 builders, and sync/atomic wrappers. It also gives NID verification, cross-checks against unresolved-import logs, the build and test results, and the items left uncovered. This matches the changeset, which adds these functions in agc.cpp, agc.h, and libAgcDriver.cpp. </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=2441)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>Share</strong></summary> <dl> <dd> <br> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <!-- tips_end --> <!-- recent_review_start --> <h6> <details> <summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Recent review info</strong></summary> <dl> <dd> <br> <!-- review_info_content --> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary> <dl> <dd> <br> - **Source mode**: Auto - **Repository**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/a1fc5ae438ea343480c9850f585d8c0afed06241/.coderabbit.yaml>) - **Commit**: [a1fc5ae](<https://github.com/KytyPS5/KytyPS5/commit/a1fc5ae438ea343480c9850f585d8c0afed06241>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `ef53bfc8-09ac-41ad-9cd0-b7de056dba35` </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between de5a949442d8b7be0ccd15fede7843283f7aacce and ccb29c3671fdd6696230271550cf04ed7462dc35. </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 3</strong></summary> <dl> <dd> <br> * `src/libs/agc.cpp` * `src/libs/agc.h` * `src/libs/libAgcDriver.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. </dd> </dl> </details> </h6> <!-- recent_review_end -->
This pull request has changes conflicting with the target branch.
  • src/libs/agc.cpp
  • src/libs/agc.h
  • src/libs/libAgcDriver.cpp
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2441/head:github-bot/gh-2441'
git switch 'github-bot/gh-2441'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2441'
git switch 'github-bot/gh-2441'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2441'
git switch 'github-bot/gh-2441'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2441'
git switch 'main'
git merge --squash 'github-bot/gh-2441'
git switch 'main'
git merge --ff-only 'github-bot/gh-2441'
git switch 'main'
git merge 'github-bot/gh-2441'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.