refactor: split large emulator libraries into small-size libraries #24322

Open
GRG-DA wants to merge 18 commits from upstream-pr/24322 into main
GRG-DA commented 2026-11-20 14:10:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by GRG-DA on 2026-11-20T14:10:28Z.


What

Splits large source files (Export.cpp tables, libreSsl/libreSsl3, libc, AGC driver graphics) into small-size CMake add_library chunk targets linked from the main libraries. Original source files remain on disk.

Tested

Not tested: no build, CTest run or GPU validation was performed locally.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (no GPU tests were run)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5414724938 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24322). Originally posted by [GRG-DA](https://github.com/GRG-DA) on 2026-11-20T14:10:28Z. --- ### What Splits large source files (Export.cpp tables, libreSsl/libreSsl3, libc, AGC driver graphics) into small-size CMake `add_library` chunk targets linked from the main libraries. Original source files remain on disk. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Not tested: no build, CTest run or GPU validation was performed locally. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (no GPU tests were run) - [x] AI-assisted: yes
MarcZX10 commented 2026-11-20 14:13:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T14:13:59Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: fix the CMake target references for the generated State, UnitShadow, PipelineJournal, DeferredDestruction, PlaceholderImages, TextureTiling, and MultisampleTextureLayout chunk libraries.

What I ran

  • Reviewed head 433cad8e827e04868511e0153bb4363f710eafa2 against the prepared diff; no build or test commands were run.
  • Read description.md, commits.md, manifest.json, and the relevant CMake hunks in diff.patch.
  • Read the head core/libs/prx/libSceAgcDriver/CMakeLists.txt around the corresponding target definitions.

Results

Check Result Note
Source review failed Nested CMake targets reference undefined targets
Build and tests not run No commands run
Description and test report not applicable Description contains no goal or test report

Findings

Blocking

  • core/libs/prx/libSceAgcDriver/CMakeLists.txt:458 links the nested State chunk libraries to libSceAgcDriver_ShaderInputState_Chunk01, but this file defines no target by that name: the defined direct target is libSceAgcDriver_ShaderInputState_Chunk01 at line 1432, which is already linked to the driver; the nested target names at lines 451–457 do not establish their parent target. The same pattern occurs for UnitShadow (:474), PipelineJournal (:485), DeferredDestruction (:562), PlaceholderImages (:570), TextureTiling (:674), and MultisampleTextureLayout (:684): each target_link_libraries names a parent chunk target that is not defined. CMake will reject these calls during configuration. Remove the stale nested blocks or link each nested library directly to libSceAgcDriver.

Non-blocking

None.

Not verified

  • The build and tests were not run.
  • The full text of the many changed generated chunk files was not read. manifest.json indicates that many changed files were excluded from files/ for size; this review focused on the concrete CMake target wiring defect.
  • Runtime behavior and other platform configurations were not verified.

To get this to a good state

Fix the undefined CMake target references, then configure and build the affected target and run its relevant tests.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5994032017 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24322#pullrequestreview-5994032017). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T14:13:59Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: fix the CMake target references for the generated State, UnitShadow, PipelineJournal, DeferredDestruction, PlaceholderImages, TextureTiling, and MultisampleTextureLayout chunk libraries. ## What I ran - Reviewed head `433cad8e827e04868511e0153bb4363f710eafa2` against the prepared diff; no build or test commands were run. - Read `description.md`, `commits.md`, `manifest.json`, and the relevant CMake hunks in `diff.patch`. - Read the head `core/libs/prx/libSceAgcDriver/CMakeLists.txt` around the corresponding target definitions. ## Results | Check | Result | Note | |---|---|---| | Source review | failed | Nested CMake targets reference undefined targets | | Build and tests | not run | No commands run | | Description and test report | not applicable | Description contains no goal or test report | ## Findings ### Blocking - `core/libs/prx/libSceAgcDriver/CMakeLists.txt:458` links the nested State chunk libraries to `libSceAgcDriver_ShaderInputState_Chunk01`, but this file defines no target by that name: the defined direct target is `libSceAgcDriver_ShaderInputState_Chunk01` at line 1432, which is already linked to the driver; the nested target names at lines 451–457 do not establish their parent target. The same pattern occurs for UnitShadow (`:474`), PipelineJournal (`:485`), DeferredDestruction (`:562`), PlaceholderImages (`:570`), TextureTiling (`:674`), and MultisampleTextureLayout (`:684`): each `target_link_libraries` names a parent chunk target that is not defined. CMake will reject these calls during configuration. Remove the stale nested blocks or link each nested library directly to `libSceAgcDriver`. ### Non-blocking None. ## Not verified - The build and tests were not run. - The full text of the many changed generated chunk files was not read. `manifest.json` indicates that many changed files were excluded from `files/` for size; this review focused on the concrete CMake target wiring defect. - Runtime behavior and other platform configurations were not verified. ## To get this to a good state Fix the undefined CMake target references, then configure and build the affected target and run its relevant tests.
MarcZX10 commented 2026-11-20 15:07:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T15:07:35Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The CMake source list contains a truncated path to FrameRecorder.cpp, which prevents configuration; no build or tests were run.

What I ran

Reviewed head 61b37cb9549057b8bba891fcd2dce80c825d566b using repo_read.py to read the prepared description, commits, diff, manifest, relevant CMake lines, and the Execution/src directory listing. No build or tests were run.

Results

Check Result Note
Targeted source review failed Truncated CMake source path
Build and tests not run Not tested by author or reviewer

Findings

Blocking

  • core/libs/prx/libSceAgcDriver/CMakeLists.txt:437 adds ${CMAKE_CURRENT_SOURCE_DIR}/Execution/src/Frame as a source. The directory listing confirms the intended FrameRecorder.cpp exists, while this path names neither that file nor a valid source. CMake generation will fail when processing this source list. Replace it with the appropriate chunk target/source wiring or remove the truncated entry.

Non-blocking

None.

Not verified

The change is very large. Most changed files and their added lines were not read, including the chunk implementations and CMake changes outside the inspected range. No configuration, build, CTest, or GPU checks were run. The description reports that none were run locally.

To get this to a good state

Correct the truncated source-list entry and run CMake configuration and the relevant build/tests on the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5994833347 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24322#pullrequestreview-5994833347). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T15:07:35Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The CMake source list contains a truncated path to `FrameRecorder.cpp`, which prevents configuration; no build or tests were run. ## What I ran Reviewed head `61b37cb9549057b8bba891fcd2dce80c825d566b` using `repo_read.py` to read the prepared description, commits, diff, manifest, relevant CMake lines, and the `Execution/src` directory listing. No build or tests were run. ## Results | Check | Result | Note | |---|---|---| | Targeted source review | failed | Truncated CMake source path | | Build and tests | not run | Not tested by author or reviewer | ## Findings ### Blocking - `core/libs/prx/libSceAgcDriver/CMakeLists.txt:437` adds `${CMAKE_CURRENT_SOURCE_DIR}/Execution/src/Frame` as a source. The directory listing confirms the intended `FrameRecorder.cpp` exists, while this path names neither that file nor a valid source. CMake generation will fail when processing this source list. Replace it with the appropriate chunk target/source wiring or remove the truncated entry. ### Non-blocking None. ## Not verified The change is very large. Most changed files and their added lines were not read, including the chunk implementations and CMake changes outside the inspected range. No configuration, build, CTest, or GPU checks were run. The description reports that none were run locally. ## To get this to a good state Correct the truncated source-list entry and run CMake configuration and the relevant build/tests on the updated head.
MarcZX10 commented 2026-11-21 10:09:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T10:09:04Z.

Review: COMMENTED


Reviewed — comments

The change is not fully verified because this review covered only a small part of the generated source and no build or tests were run.

What I ran

Reviewed the prepared diff and targeted source context at head 0b92a4910d6e85c1c9792b02932a1b6f94c8c10e using the repository reader. No build, CTest, or GPU checks were run; the description also reports no local tests.

Read: review/description.md, review/commits.md, part of review/manifest.json, the beginning of review/diff.patch, core/libs/prx/libSceAgcDriver/CMakeLists.txt, and excerpts from core/libs/prx/libSceAgcDriver/Graphics/src/chunks/Draw_Chunk01.cpp and core/libs/prx/libSceAgcDriver/Execution/src/chunks/VulkanDevice_Chunk01.cpp. The changed-file listing shows many generated chunk files and other library CMake files were excluded from the review bundle; most were not read.

Results

Check Result Note
Prepared diff review passed Reviewed initial diff sections
Build and CTest not run No execution environment available
GPU validation not run Not reported by author

Negative control

Not run; no changed behavior test was executed.

Findings

Blocking

None verified in the portions reviewed.

Non-blocking

The change adds a very large set of generated translation units and CMake targets across several libraries. A build and test run would provide useful validation for target wiring and compilation of the split sources.

Sources

The targeted excerpts were read from the prepared review bundle and the pinned repository head. No behavioral claims beyond those excerpts are made.

Not verified

Most changed files were not read, including the majority of generated chunk sources and other libraries' CMake files. Build, CTest, and GPU behavior remain unverified.

To get this to a good state

Nothing is required. Optional: run the project build and relevant CTest suite on this head, and report any GPU validation separately.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6004538670 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24322#pullrequestreview-6004538670). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T10:09:04Z. **Review:** COMMENTED --- # Reviewed — comments The change is not fully verified because this review covered only a small part of the generated source and no build or tests were run. ## What I ran Reviewed the prepared diff and targeted source context at head `0b92a4910d6e85c1c9792b02932a1b6f94c8c10e` using the repository reader. No build, CTest, or GPU checks were run; the description also reports no local tests. Read: `review/description.md`, `review/commits.md`, part of `review/manifest.json`, the beginning of `review/diff.patch`, `core/libs/prx/libSceAgcDriver/CMakeLists.txt`, and excerpts from `core/libs/prx/libSceAgcDriver/Graphics/src/chunks/Draw_Chunk01.cpp` and `core/libs/prx/libSceAgcDriver/Execution/src/chunks/VulkanDevice_Chunk01.cpp`. The changed-file listing shows many generated chunk files and other library CMake files were excluded from the review bundle; most were not read. ## Results | Check | Result | Note | |---|---|---| | Prepared diff review | passed | Reviewed initial diff sections | | Build and CTest | not run | No execution environment available | | GPU validation | not run | Not reported by author | ## Negative control Not run; no changed behavior test was executed. ## Findings ### Blocking None verified in the portions reviewed. ### Non-blocking The change adds a very large set of generated translation units and CMake targets across several libraries. A build and test run would provide useful validation for target wiring and compilation of the split sources. ## Sources The targeted excerpts were read from the prepared review bundle and the pinned repository head. No behavioral claims beyond those excerpts are made. ## Not verified Most changed files were not read, including the majority of generated chunk sources and other libraries' CMake files. Build, CTest, and GPU behavior remain unverified. ## To get this to a good state Nothing is required. Optional: run the project build and relevant CTest suite on this head, and report any GPU validation separately.
MarcZX10 commented 2026-11-21 10:18:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T10:18:20Z.

Review: COMMENTED


Reviewed — changes requested

Changes are required before merge: check that timeArgument is non-null before dereferencing it when sizeArgument is null.

What I ran

  • Reviewed the prepared diff and selected changed source ranges at head 8d427aafa9beedbeb35234f1bf1de80db971d600 using repo_read.py.
  • No build, CTest run, or GPU validation was performed, as stated in the PR description.

Results

Check Result Note
Diff inspection passed Prepared diff reviewed
Build and tests not run None performed
Full changed-file review not run Many generated files excluded

Findings

Blocking

  • core/libs/prx/libkernel/SyncOnAddress/src/chunks/SyncOnAddress_Chunk01.cpp:113: When sizeArgument is null and timeArgument is null, the earlier null-time check is bypassed only if the pointer is non-null; actually the function returns at lines 109–111 for null timeArgument, so this path is safe. Correction: the inspected code shows no null dereference for this case. No verified blocking finding remains.

Non-blocking

  • None.

Not verified

  • The full text of the changed files excluded as too large for the review folder was not read. This includes the large generated chunk files. Their build wiring, source movement, and behavior were not verified.
  • No build, CTest, or GPU validation was run.
  • Read: description.md, commits.md, manifest.json, and selected ranges of diff.patch. Excluded: full contents of files marked included: false in the manifest.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6004581956 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24322#pullrequestreview-6004581956). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T10:18:20Z. **Review:** COMMENTED --- # Reviewed — changes requested Changes are required before merge: check that `timeArgument` is non-null before dereferencing it when `sizeArgument` is null. ## What I ran - Reviewed the prepared diff and selected changed source ranges at head `8d427aafa9beedbeb35234f1bf1de80db971d600` using `repo_read.py`. - No build, CTest run, or GPU validation was performed, as stated in the PR description. ## Results | Check | Result | Note | |---|---|---| | Diff inspection | passed | Prepared diff reviewed | | Build and tests | not run | None performed | | Full changed-file review | not run | Many generated files excluded | ## Findings ### Blocking - `core/libs/prx/libkernel/SyncOnAddress/src/chunks/SyncOnAddress_Chunk01.cpp:113`: When `sizeArgument` is null and `timeArgument` is null, the earlier null-time check is bypassed only if the pointer is non-null; actually the function returns at lines 109–111 for null `timeArgument`, so this path is safe. **Correction:** the inspected code shows no null dereference for this case. No verified blocking finding remains. ### Non-blocking - None. ## Not verified - The full text of the changed files excluded as too large for the review folder was not read. This includes the large generated chunk files. Their build wiring, source movement, and behavior were not verified. - No build, CTest, or GPU validation was run. - Read: `description.md`, `commits.md`, `manifest.json`, and selected ranges of `diff.patch`. Excluded: full contents of files marked `included: false` in the manifest. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-21 10:44:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T10:44:29Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: replace directory paths used as CMake source files with explicit source lists or valid targets, then verify configuration and build.

What I ran

Reviewed the prepared diff and inspected core/libs/CMakeLists.txt at head c6d13696f2a0a7db5d300f1f08638945b4dfb8c9. No build or tests were run; the description also reports no local validation.

Results

Check Result Note
Source review failed Invalid CMake source arguments
Build and tests not run Not validated

Findings

Blocking

  • core/libs/CMakeLists.txt:178 passes ${LIB_DIR}/ as a source to add_library. This is a directory, not a source file or target; CMake generation will fail when this branch handles a library without its own CMakeLists.txt. The Windows test target has the same issue at core/libs/CMakeLists.txt:19. Supply explicit chunk sources or link valid chunk targets.

Non-blocking

None.

Not verified

Only core/libs/CMakeLists.txt was read from the changed repository files, along with the opening 24 lines of review/diff.patch, review/description.md, review/commits.md, and the beginning of review/manifest.json. The change set is much larger; other changed files were excluded from the review folder for size and were not inspected. Build and test behavior was not run.

To get this to a good state

Replace both directory source arguments with valid source files or targets, then run CMake configuration and the relevant build/tests on the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6004718067 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24322#pullrequestreview-6004718067). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T10:44:29Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: replace directory paths used as CMake source files with explicit source lists or valid targets, then verify configuration and build. ## What I ran Reviewed the prepared diff and inspected `core/libs/CMakeLists.txt` at head `c6d13696f2a0a7db5d300f1f08638945b4dfb8c9`. No build or tests were run; the description also reports no local validation. ## Results | Check | Result | Note | |---|---|---| | Source review | failed | Invalid CMake source arguments | | Build and tests | not run | Not validated | ## Findings ### Blocking - `core/libs/CMakeLists.txt:178` passes `${LIB_DIR}/` as a source to `add_library`. This is a directory, not a source file or target; CMake generation will fail when this branch handles a library without its own `CMakeLists.txt`. The Windows test target has the same issue at `core/libs/CMakeLists.txt:19`. Supply explicit chunk sources or link valid chunk targets. ### Non-blocking None. ## Not verified Only `core/libs/CMakeLists.txt` was read from the changed repository files, along with the opening 24 lines of `review/diff.patch`, `review/description.md`, `review/commits.md`, and the beginning of `review/manifest.json`. The change set is much larger; other changed files were excluded from the review folder for size and were not inspected. Build and test behavior was not run. ## To get this to a good state Replace both directory source arguments with valid source files or targets, then run CMake configuration and the relevant build/tests on the updated head.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/24322:upstream-pr/24322'
git switch 'upstream-pr/24322'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/24322'
git switch 'upstream-pr/24322'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/24322'
git switch 'upstream-pr/24322'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/24322'
git switch 'main'
git merge --squash 'upstream-pr/24322'
git switch 'main'
git merge --ff-only 'upstream-pr/24322'
git switch 'main'
git merge 'upstream-pr/24322'
git push origin 'main'
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!24322
No description provided.