audio: accept NGS2 sampler waveform controls on non-sampler racks #968
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!968
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/968/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@mriamnobody on GitHub · 2026-10-02 04:34 UTC · original
mriamnobody:audio-ngs2-waveform-control-rack-types→main· +164 −2 · 3 files · 1 commits · closed without mergingSummary
The NGS2 voice-control gate required an exact rack-type match: control id
0x1000(sampler waveform setup) was only accepted onSamplerracks (and0x4001onCustomSamplerracks), andEXIT_NOT_IMPLEMENTEDfired otherwise (ngs2.cpp:2357).Games legally drive these controls on other rack types. Atomfall (Asura engine, PPSA15493) owns only one Mastering rack (
0x3000) and five CustomSubmixer racks (0x4002) — no sampler rack at all — yet sendsid = 0x10000000to a CustomSubmixer-rack voice, killing the emulator right after the intro video (AvPlayer video stopped-> fatal). Since the game plays audio on hardware while owning no sampler racks, the strict check is over-restrictive.Safety: the entire handler behind the check (
SetupSampler,ngs2.cpp:577) and the block path touch only per-voice state (channels, sample rate, decoder, blocks, filters) — norack->optionunion access. The change allow-lists all seven known rack types; an unknown future type still fails as a genuine "not implemented".Changes
src/libs/ngs2.cpp— replace the strict rack-type equality with an allow-list of all knownNgs2RackTypevaluestests/Ngs2RackControlTests.cpp(new) +CMakeLists.txtregistration —ngs2_rack_control_testscovering:0x10000000setup -> non-repeating block queue)Testing performed
ngs2_rack_control_tests: all 4 cases passngs2_sampler_tests: all existing cases pass (no regression)kernel_file_system_tests,save_data_memory_tests) reproduce identically on a pristine build ofmain(verified by stashing this change) — pre-existing/environmental, unrelated to this PRngs2.cpp:2357immediately after the intro video; with this change the game passes the gate, its NGS2 racks/voices initialize, and it progresses into shader compilation until an unrelated later issue (shader resource tracking, the open #855 class:hash=0x4b3c8fdeb1ad6300 stage=pixel pc=0x1c40 GetImageResource dword 0 is not a valid runtime value) — reproduced identically on the latest release buildb3e419f, i.e. independent of this PRRelated issues
AI disclosure (per contributing policy)
This change was developed with AI assistance (analysis, patch drafting, and test writing). The submitter ran the build and test suite locally, reviewed the diff, and performed the live game verification described above; all submitted code has been reviewed and tested by the human contributor.
@coderabbitai[bot] on GitHub · 2026-10-02 04:37 UTC · original · edited 2026-10-02 04:41 UTC
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
📝 Walkthrough
Walkthrough
Waveform setup and block controls now pass the rack-type check for all seven known rack types. New regression tests check control results, voice configuration, and rendering on CustomSubmixer and Sampler racks. CMake now defines the test executable and its dependencies.
Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix
Merge Risk: 🔵 Low · up to
7aaddWaveform controls are now accepted on all known NGS2 rack types, which unblocks the Atomfall startup. A title that queues blocks repeatedly on a non-sampler voice could grow memory. This is worth a follow-up but is not likely to block merge.
Security Architecture Review
Security architecture risk: 🔵 Low · up to
7aaddNewly accepted waveform blocks can remain queued indefinitely on non-sampler voices. Continued submissions may exhaust emulator memory unless the caller explicitly clears, resets, or destroys the rack. The exposure is confined to the existing emulator process; no additional privilege boundary was identified.
Retained concerns
Security review details
Security Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
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
Comment
@coderabbitai helpto get the list of available commands.@ -2357,1 +2362,3 @@(rack_id == 0x1000 ? Ngs2RackType::Sampler : Ngs2RackType::CustomSampler));voice->rack->type != Ngs2RackType::Sampler &&voice->rack->type != Ngs2RackType::CustomSampler &&voice->rack->type != Ngs2RackType::Submixer &&@coderabbitai[bot] on GitHub · 2026-10-02 04:37 UTC · original
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
Advance or release blocks accepted on non-sampler racks.
If a non-sampler voice repeatedly queues blocks with flag
1, control0x10000001keeps appending tovoice.blocks.Ngs2RenderVoiceconsumes blocks only on Sampler and CustomSampler racks. Rendering therefore never drains this queue or runs its block-completion callbacks. A long-running stream can retain an unbounded number of blocks. Add a neutral completion path for non-sampler voices, or avoid retaining blocks that cannot be consumed.@coderabbitai[bot] on GitHub · 2026-10-02 04:37 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
e512001a-5fec-47ab-9545-20434044f533📥 Commits
Reviewing files that changed from the base of the PR and between
b3e419ff11and7aaddca2d2.📒 Files selected for processing (3)
CMakeLists.txtsrc/libs/ngs2.cpptests/Ngs2RackControlTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@Nmzik on GitHub · 2026-10-08 14:46 UTC · original
This is a hack
Pull request closed