Skip to content

feat(libSceAgc): implement sceAgcAcquireMemSetEngine - #1060

Open
Kikoarl wants to merge 1 commit into
boykopovar:mainfrom
Kikoarl:feat/agc-acquire-mem-set-engine
Open

Kikoarl wants to merge 1 commit into
boykopovar:mainfrom
Kikoarl:feat/agc-acquire-mem-set-engine

Conversation

@Kikoarl

@Kikoarl Kikoarl commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

What

Implements sceAgcAcquireMemSetEngine in libSceAgc.

Provenance:

  • Identified via SHA-1 NID matching (NID W0WEyog0f74) from compatibility analysis of New Joe & Mac Caveman Ninja (PPSA02801).
  • Reference: OpenAGC src/game_compat.c (Compatibility-SPRX W0WEyog0f74 @ 0xd450).
  • Semantics: Validates that the command pointer points to an ACQUIRE_MEM (opcode 0x58, 8 dwords) packet and that the engine selector has only bit 0 set. Modifies word 1 of the packet by clearing bit 31 and updating it with (engine << 31u), preserving the remaining cbDbOp bits. Throws on misaligned/null pointer, invalid packet type/size, or if reserved bits are set in engine.
  • Added technical debt entry to docs/dev/TechnicalDebt.md in the same commit.

Tested

  • Automated tests: added comprehensive test coverage in tests/Commands.cpp verifying:
    • Patching ACQUIRE_MEM packets emitted by both sceAgcDcbAcquireMem and sceAgcAcbAcquireMem.
    • Switching engine between 0 and 1 while preserving payload cbDbOp.
    • Negative cases: null pointer, misaligned pointer, out-of-range engine values (engine > 1), wrong packet opcode, verifying memory is untouched on failure.
    • All 34 AGC ctest tests pass.
  • Verified library coverage increase via tools/progress.py.

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

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Progress report (90c6839 → af43adf)

📈 System libraries: 87.89% (+0.02%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceAgc sceAgcAcquireMemSetEngine

@popcoder565

Copy link
Copy Markdown
Contributor

Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head ef1a412d, merged onto main 8b393b6 in one build with 31 other PRs that had no Windows run.

No title was run.

🤖 Addressed by Claude Code

@frankea

frankea commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Windows run of this PR alone on current main. Head ef1a412d merged onto c72d5ce1 (clean); Windows 11 10.0.26200, RTX 4090 (NVIDIA 616.92, subgroup 32, so every GPU execution test runs), MinGW-w64 GCC 15.2.0 r7, Release, BUILD_TESTING=ON.

No title was run. Tested with AI assistance (Claude Code).

@blawesom

Copy link
Copy Markdown
Contributor

Hi! This PR currently conflicts with main, so I rebased it onto the latest main (d3e84f85, includes #3296). The only conflict was the extern-declaration list in core/libs/prx/libSceAgc/tests/Commands.cpp, resolved by keeping both sides' declarations. It builds and agc_command_tests passes locally.

If it helps, the rebased branch is available to pull:

git fetch https://github.com/blawesom/AnyPS5 rebase/pr-1060
git reset --hard FETCH_HEAD

Feel free to ignore this if you'd rather rebase yourself.

RINNECODER added a commit to RINNECODER/AnyPS5 that referenced this pull request Oct 11, 2026
…l bridge (#373)

* Apply upstream open AGC PRs for the remaining stubbed imports

Ports upstream boykopovar/AnyPS5 open PRs into core/libs/prx (libs and
their tests only; docs excluded):
- boykopovar#2847 DCB/ACB marker span builders
- boykopovar#2848 occlusion query size queries
- boykopovar#2849 submit validation reported as unavailable
- boykopovar#2850 disabled shader instrumentation accepted
- boykopovar#2851 GPU capture reported as unavailable, shader debugging status
- boykopovar#1060 sceAgcAcquireMemSetEngine

Conflicts between the PRs (Unimplemented.cpp stubs and shared test
files) were resolved by keeping every change from both sides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Port libSceAgcDriver leaf imports and remaining libSceAgc rows to the Metal bridge

Binds the 35 libSceAgcDriver imports and 17 libSceAgc imports through
SceAgcImports without dereferencing guest pointers on the host:

- Driver leaf exports (resource registration, capture, submit
  validation, equeue queries) run the upstream bodies through prx bridge
  descriptors (upstream-prx/AgcDriver.cpp); the 7-argument registrations
  read user data from the caller stack.
- ACB flip and rendering wait emit the Metal driver packets, as the DCB
  rows do.
- Marker spans, occlusion sizes, shader instrumentation, AcquireMemSetEngine
  and branch _0300 patchers reuse upstream encoders on host copies.
- GetRegisterDefaults2(+Internal) publish the upstream tables in a guest
  window above the gate table; Create/UpdatePrimState run on host copies
  of the stage type and special registers.

New CTest anyps5_cpu_agc_driver_leaf is in NATIVE_REQUIRED_TESTS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@Kikoarl
Kikoarl force-pushed the feat/agc-acquire-mem-set-engine branch from ef1a412 to 54fa2c7 Compare October 11, 2026 10:57
@Kikoarl

Kikoarl commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

@blawesom Thank you for the heads-up and resolving the declarations in Commands.cpp! Rebased cleanly onto latest main, verified agc_commands tests pass, and pushed.

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 11, 2026
@Kikoarl
Kikoarl force-pushed the feat/agc-acquire-mem-set-engine branch from 54fa2c7 to dfe2770 Compare October 12, 2026 14:30
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 12, 2026
@Kikoarl
Kikoarl force-pushed the feat/agc-acquire-mem-set-engine branch from dfe2770 to 4ef0cbc Compare October 12, 2026 18:44
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

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 7692 core/libs/prx/libSceAgc/tests/Commands.cpp
docs/dev/debt/libSceAgc.md
PR 8296 core/libs/prx/libSceAgc/Unimplemented.cpp
PR 8302 docs/dev/debt/libSceAgc.md
PR 8318 core/libs/prx/libSceAgc/Unimplemented.cpp
docs/dev/debt/libSceAgc.md
PR 8402 docs/dev/debt/libSceAgc.md
PR 8453 docs/dev/debt/libSceAgc.md
PR 8924 core/libs/prx/libSceAgc/Unimplemented.cpp
core/libs/prx/libSceAgc/tests/Commands.cpp
PR 8944 core/libs/prx/libSceAgc/Unimplemented.cpp
docs/dev/debt/libSceAgc.md
PR 9166 docs/dev/debt/libSceAgc.md

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs needs rebase Conflicts with main, rebase needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants