fix(ngs2): resolve voice patches to rack handles #4777

Merged
MarcZX10 merged 1 commit from upstream-pr/4777 into main 2026-10-14 06:05:53 +00:00
MarcZX10 commented 2026-10-12 21:35:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T21:35:13Z.


What

Allow sceNgs2VoiceControl's patch parameter to name a destination rack handle when dest_input_id is 0. The rack's first voice receives the patch. The reported Dead Cells call in issue #4334 passes a mastering rack handle as dest_handle; treating it only as a voice handle currently throws invalid argument.

The regression creates a mastering rack and sampler, patches the sampler to the rack handle, checks that port info reports the rack's first voice as its destination, and verifies rendered PCM reaches the output. Racks with multiple voices and nonzero destination input ids are not established by the available evidence; nonzero input ids continue to throw.

Tested

  • Linux Release: ngs2_render passed (1/1).
  • Negative control: restoring the original Voice.cpp made the new test fail with Patch: invalid argument.
  • python3 tools/check_conventions.py --base upstream/main passed.
  • git diff --check passed.
  • Not tested on a console; the first-voice selection for multi-voice racks remains unverified there.

Checklist

  • Based on current main; no open PR implements this rack-handle destination behavior
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw or use NotImplemented_nid_no_patch
  • No investigation files added to the repository
  • No new third-party code
  • Generic behavior
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4835261122 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4777). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T21:35:13Z. --- ### What Allow `sceNgs2VoiceControl`'s patch parameter to name a destination rack handle when `dest_input_id` is 0. The rack's first voice receives the patch. The reported Dead Cells call in [issue #4334](https://github.com/boykopovar/AnyPS5/issues/4334) passes a mastering rack handle as `dest_handle`; treating it only as a voice handle currently throws `invalid argument`. The regression creates a mastering rack and sampler, patches the sampler to the rack handle, checks that port info reports the rack's first voice as its destination, and verifies rendered PCM reaches the output. Racks with multiple voices and nonzero destination input ids are not established by the available evidence; nonzero input ids continue to throw. ### Tested - Linux Release: `ngs2_render` passed (1/1). - Negative control: restoring the original `Voice.cpp` made the new test fail with `Patch: invalid argument`. - `python3 tools/check_conventions.py --base upstream/main` passed. - `git diff --check` passed. - Not tested on a console; the first-voice selection for multi-voice racks remains unverified there. ### Checklist - [x] Based on current `main`; no open PR implements this rack-handle destination behavior - [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 or use `NotImplemented_nid_no_patch` - [x] No investigation files added to the repository - [x] No new third-party code - [x] Generic behavior - [x] Depends on: none - [x] AI-assisted: yes
xXPBSXx commented 2026-10-13 03:55:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T03:55:17Z.


Windows test: head 41ea3e143 merged onto current main 495bf91a0 (clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release, -j2: full build 0 errors; ctest with the filter ngs2_core_render: ngs2_core_render passed (1 test(s), 0 failed); python tools/check_conventions.py --base upstream/main passed. I did not run the new tests against main without the change.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6137874828 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4777#issuecomment-6137874828). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-13T03:55:17Z. --- Windows test: head `41ea3e143` merged onto current `main` `495bf91a0` (clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release, `-j2`: full build 0 errors; ctest with the filter `ngs2_core_render`: ngs2_core_render passed (1 test(s), 0 failed); `python tools/check_conventions.py --base upstream/main` passed. I did not run the new tests against `main` without the change. AI-assisted (Claude Code).
p3n1cillin commented 2026-10-13 18:48:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-13T18:48:02Z.


Dead Cells (PPSA15552) needs this on top of #4417: with #4417 alone it stops on Patch: invalid argument because it patches a sampler voice to a rack handle, and with this PR merged as well it gets past patching (details in https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6152733807). The merge with #4417 conflicts in Patch; I kept both the rack-handle fallback and #4417's CUSTOM_SAMPLER destination check.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6152734585 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4777#issuecomment-6152734585). Originally posted by [p3n1cillin](https://github.com/p3n1cillin) on 2026-10-13T18:48:02Z. --- Dead Cells (PPSA15552) needs this on top of #4417: with #4417 alone it stops on `Patch: invalid argument` because it patches a sampler voice to a rack handle, and with this PR merged as well it gets past patching (details in https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6152733807). The merge with #4417 conflicts in `Patch`; I kept both the rack-handle fallback and #4417's `CUSTOM_SAMPLER` destination check.
MarcZX10 commented 2026-10-13 20:13:10 +00:00 (Migrated from github.com)

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


Rebased onto current main after #4417 merged (head 8b0da182a018). The Voice.cpp resolution preserves the rack-handle fallback and #4417’s rejection of both regular and custom-sampler destinations. The rebased commit author remains MarcZX100.

Linux GCC 12.2 Release: built ngs2_render_tests; ctest -R "^ngs2_render$" passed (1/1). tools/check_conventions.py --base upstream/main and git diff --check pass. The hosted conventions check is rerunning now; Linux/Windows/relinker test jobs are skipped by the repository path filters for this change.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6154278753 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4777#issuecomment-6154278753). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T20:13:10Z. --- Rebased onto current `main` after #4417 merged (head `8b0da182a018`). The `Voice.cpp` resolution preserves the rack-handle fallback and #4417’s rejection of both regular and custom-sampler destinations. The rebased commit author remains MarcZX100. Linux GCC 12.2 Release: built `ngs2_render_tests`; `ctest -R "^ngs2_render$"` passed (1/1). `tools/check_conventions.py --base upstream/main` and `git diff --check` pass. The hosted conventions check is rerunning now; Linux/Windows/relinker test jobs are skipped by the repository path filters for this change.
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!4777
No description provided.