audio: play dataless and streamed NGS2 PCM waveform blocks for Oricru #1787

Manually merged
github merged 1 commit from gh-pr/1787/head into gh-pr/1787/base 2026-11-26 10:05:47 +00:00
Owner

@⁠PhialsBasement on GitHub · 2026-10-21 15:14 UTC · original
PhialsBasement:fix/oricru-ngs2-pcm-blocks → main · +98 −47 · 2 files · 1 commits · merged 2026-10-22 00:09 UTC

Game

The Last Oricru (PPSA04867, 01.005.000)

Problem

The Last Oricru stops before the main menu with:

--- Fatal Error ---
Not implemented (decoder == nullptr && (uint64_t(info.num_skip_samples) + info.num_samples) * channels * sizeof(int16_t) > info.data_size) in src/libs/ngs2.cpp

The sampler rejects any PCM waveform block whose data covers less than its num_samples. The game submits blocks of that kind, which the NGS2 sampler previously treated as unimplemented.

Changes

  • Dataless blocks (flag 0x10): a PCM block with flag 0x10 and data_size 0 plays num_samples frames of silence, reports them through num_decoded_samples and decoded_data_size, and finishes like a complete block. ATRAC9 voices still stop with EXIT_NOT_IMPLEMENTED for this case. The existing meaning of 0x10 together with 0x2 on ATRAC9 (do not join contiguous data) is unchanged.
  • Streamed PCM: a PCM block without skipped samples or repeats, whose data is whole frames but shorter than num_samples, starts a stream. Flag 0x2 on a PCM voice appends pieces to that stream. While the voice accepts blocks, the stream outputs silence without advancing once it runs out of data. After it is closed, it ends at num_samples or at its last appended frame. waveform_data follows the read position inside the current piece, and played pieces are released.

The behaviour follows AnyPS5's implementation of the same cases (boykopovar/AnyPS5#2744 and its streaming PCM support). The real name of flag 0x10 and the console's behaviour have not been verified on hardware.

Evidence

  • Before: the fatal error above, before the main menu.
  • After: the game reaches the main menu (Radeon RX 9070 XT, RADV, Linux).
Screenshot_20261022_020743

Tests

ngs2_sampler_tests passes on Linux, including two new cases:

  • TestSilentWaveformBlocks: a dataless 0x11 block followed by a data block, checking silence, the null read address and published progress.
  • TestPcmStreamAppend: waiting on an open stream, out of order appends, releasing played pieces, ending at num_samples, and a stream closed before its declared samples.

🤖 Generated with Claude Code

**@⁠PhialsBasement** on GitHub · 2026-10-21 15:14 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1787) `PhialsBasement:fix/oricru-ngs2-pcm-blocks` → `main` · +98 −47 · 2 files · 1 commits · merged 2026-10-22 00:09 UTC ## Game The Last Oricru (PPSA04867, 01.005.000) ## Problem The Last Oricru stops before the main menu with: --- Fatal Error --- Not implemented (decoder == nullptr && (uint64_t(info.num_skip_samples) + info.num_samples) * channels * sizeof(int16_t) > info.data_size) in src/libs/ngs2.cpp The sampler rejects any PCM waveform block whose data covers less than its `num_samples`. The game submits blocks of that kind, which the NGS2 sampler previously treated as unimplemented. ## Changes - **Dataless blocks (flag `0x10`):** a PCM block with flag `0x10` and `data_size` 0 plays `num_samples` frames of silence, reports them through `num_decoded_samples` and `decoded_data_size`, and finishes like a complete block. ATRAC9 voices still stop with `EXIT_NOT_IMPLEMENTED` for this case. The existing meaning of `0x10` together with `0x2` on ATRAC9 (do not join contiguous data) is unchanged. - **Streamed PCM:** a PCM block without skipped samples or repeats, whose data is whole frames but shorter than `num_samples`, starts a stream. Flag `0x2` on a PCM voice appends pieces to that stream. While the voice accepts blocks, the stream outputs silence without advancing once it runs out of data. After it is closed, it ends at `num_samples` or at its last appended frame. `waveform_data` follows the read position inside the current piece, and played pieces are released. The behaviour follows AnyPS5's implementation of the same cases (boykopovar/AnyPS5#2744 and its streaming PCM support). The real name of flag `0x10` and the console's behaviour have not been verified on hardware. ## Evidence - Before: the fatal error above, before the main menu. - After: the game reaches the main menu (Radeon RX 9070 XT, RADV, Linux). <img width="1273" height="734" alt="Screenshot_20261022_020743" src="https://github.com/user-attachments/assets/e67ab553-6d6a-4e8d-9e4b-8a0bcf3a6d24" /> ## Tests `ngs2_sampler_tests` passes on Linux, including two new cases: - `TestSilentWaveformBlocks`: a dataless `0x11` block followed by a data block, checking silence, the null read address and published progress. - `TestPcmStreamAppend`: waiting on an open stream, out of order appends, releasing played pieces, ending at `num_samples`, and a stream closed before its declared samples. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:05:44 +00:00
github manually merged commit 817231886c into gh-pr/1787/base 2026-11-26 10:05:47 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-21 15:35 UTC · original

Review in Change Stack →

📝 Walkthrough

NGS2 PCM blocks now support appended, frame-aligned streaming data and track available frames and pieces. Data-only additions append pieces, and continuation flags control whether more blocks are accepted. Decoder-backed silence blocks can contain no PCM data. PCM decoding waits for stream data, consumes available pieces, and finishes closed streams when drained. Tests cover silent output, appended-piece handling, read addresses, and decoded progress.

Suggested reviewers: cosmo

Priority: ⬆️ High

Change: Bug fix

Merge Risk: 🔵 Low · up to 0e068

A late append after a completed stream can abort the emulator. This appears limited to that sequence, but handling it before merge would avoid the crash.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: support for dataless and streamed NGS2 PCM waveform blocks for Oricru.
Description check Passed The description is directly related to the changeset. It explains the NGS2 PCM issue, the dataless and streamed PCM behavior, tests, and observed game result.
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.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-21 15:35 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1787#issuecomment-6319875082) <!-- 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/1787?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-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> NGS2 PCM blocks now support appended, frame-aligned streaming data and track available frames and pieces. Data-only additions append pieces, and continuation flags control whether more blocks are accepted. Decoder-backed silence blocks can contain no PCM data. PCM decoding waits for stream data, consumes available pieces, and finishes closed streams when drained. Tests cover silent output, appended-piece handling, read addresses, and decoded progress. **Suggested reviewers:** `cosmo` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ⬆️ High <!-- change_assessment_commit:"0e068c3fe20baf4d1f092ffbf1fa5db018709e46" --> **Change:** Bug fix <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong>🔵 Low</strong> · up to <code>0e068</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **🔵 Low** · up to `0e068` --> <!-- final_review_risk_coverage:{"sourceCommitId":"0e068c3fe20baf4d1f092ffbf1fa5db018709e46","coveredCommitId":"0e068c3fe20baf4d1f092ffbf1fa5db018709e46","kind":"reviewed"} --> A late append after a completed stream can abort the emulator. This appears limited to that sequence, but handling it before merge would avoid the crash. <!-- 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 · <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> 1</strong></summary> <dl> <dd> <strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> Failed checks: 1 warning</strong> | Check name | Status | Explanation | Resolution | | :---------------- | :----------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 2 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong><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> Passed checks: 4 passed</strong></summary> <dl> <dd> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly and concisely describes the main change: support for dataless and streamed NGS2 PCM waveform blocks for Oricru. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description is directly related to the changeset. It explains the NGS2 PCM issue, the dataless and streamed PCM behavior, tests, and observed game result. | | 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. | </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1787)! 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> - [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> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-21 15:35 UTC · original
On src/libs/ngs2.cpp line 711 (outdated):

@@ -675,6 +705,27 @@ struct Ngs2VoiceInternal {
 		}
 	}
 
+	int AppendStream(const uint8_t* data, uint32_t flags, uint32_t count,
+	                 const Ngs2WaveformBlock* waveform_blocks) {
+		EXIT_NOT_IMPLEMENTED(channels == 0 || (flags & 4u) != 0 || blocks.empty() ||
+		                     !blocks.back().streaming);

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

git diff 4644c5292773095b8ee30483aaf6e017bba3c713 0e068c3fe20baf4d1f092ffbf1fa5db018709e46 -- src/libs/ngs2.cpp tests/Ngs2SamplerTests.cpp | sed -n '1,320p'
sed -n '580,795p' src/libs/ngs2.cpp
sed -n '1630,1725p' tests/Ngs2SamplerTests.cpp

Repository: KytyPS5/KytyPS5

Length of output: 24005


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- symbols and callers ---'
rg -n -F --glob '*.{cpp,h,hpp}' -e 'AddWaveformBlocks' -e 'Ngs2FinishBlock' -e 'ONLY_DATA' -e '0x2' src tests include 2>/dev/null || true
printf '%s\n' '--- head queue/finish implementation ---'
nl -ba src/libs/ngs2.cpp | sed -n '620,840p'
printf '%s\n' '--- finish and PCM decode definitions ---'
rg -n -F -- 'Ngs2FinishBlock' src/libs/ngs2.cpp
nl -ba src/libs/ngs2.cpp | sed -n '1500,1735p'
printf '%s\n' '--- relevant head tests and fixture API ---'
rg -n -F --glob 'tests/Ngs2SamplerTests.cpp' -e 'QueueBlocks' -e 'ONLY_DATA' -e 'TestPcmStreamAppend' -e 'Ngs2WaveformBlock' tests/Ngs2SamplerTests.cpp
printf '%s\n' '--- base implementation and tests ---'
git show 4644c5292773095b8ee30483aaf6e017bba3c713:src/libs/ngs2.cpp | nl -ba | sed -n '620,810p'
git show 4644c5292773095b8ee30483aaf6e017bba3c713:tests/Ngs2SamplerTests.cpp | rg -n -F -e 'QueueBlocks' -e 'Ngs2WaveformBlock' -e 'ONLY_DATA' || true

Repository: KytyPS5/KytyPS5

Length of output: 42695


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- exact waveform API declarations and definitions ---'
rg -n -F --glob '*.cpp' --glob '*.h' --glob '*.hpp' -e 'Ngs2VoiceAddWaveformBlocks' -e 'Ngs2AddWaveformBlocks' -e 'AddWaveformBlocks' -e 'Ngs2WaveformBlock' src include tests 2>/dev/null || true
printf '%s\n' '--- flags and waveform API documentation/comments ---'
rg -n -i --glob '*.cpp' --glob '*.h' --glob '*.hpp' -e 'only.?data' -e 'waveform.*block' -e 'add.*waveform' -e 'continuation' src include tests docs 2>/dev/null || true
printf '%s\n' '--- head public API region around waveform calls ---'
rg -n -F --glob 'src/libs/ngs2.cpp' -e 'Waveform' -e 'waveform' src/libs/ngs2.cpp | tail -80
printf '%s\n' '--- complete head test fixture and waveform tests ---'
nl -ba tests/Ngs2SamplerTests.cpp | sed -n '1,190p'
nl -ba tests/Ngs2SamplerTests.cpp | sed -n '1230,1380p'
printf '%s\n' '--- base/head exact AddWaveformBlocks diff ---'
git diff 4644c5292773095b8ee30483aaf6e017bba3c713 0e068c3fe20baf4d1f092ffbf1fa5db018709e46 --unified=80 -- src/libs/ngs2.cpp | sed -n '130,300p'

Repository: KytyPS5/KytyPS5

Length of output: 42155


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- guest dispatch and result handling ---'
nl -ba src/libs/ngs2.cpp | sed -n '180,255p'
nl -ba src/libs/ngs2.cpp | sed -n '2560,2635p'
printf '%s\n' '--- public declarations ---'
nl -ba src/libs/ngs2.h | sed -n '1,90p'
printf '%s\n' '--- all accepts_blocks assignments and checks ---'
rg -n -F -- 'accepts_blocks' src/libs/ngs2.cpp tests/Ngs2SamplerTests.cpp

Repository: KytyPS5/KytyPS5

Length of output: 12795


Handle a late PCM stream append without aborting.

A completed PCM stream is removed from blocks, but accepts_blocks remains enabled when the stream used continuation flag 0x1. A later guest ONLY_DATA request is forwarded to AppendStream, which then aborts because blocks is empty.

Limit the no-op behavior to an empty queue. The ordinary-block case is not a regression because the base implementation rejected all PCM ONLY_DATA requests.

Suggested fix
--- "a/src/libs/ngs2.cpp"
+++ "b/src/libs/ngs2.cpp"
@@ -707,8 +707,12 @@
 
 	int AppendStream(const uint8_t* data, uint32_t flags, uint32_t count,
 	                 const Ngs2WaveformBlock* waveform_blocks) {
-		EXIT_NOT_IMPLEMENTED(channels == 0 || (flags & 4u) != 0 || blocks.empty() ||
-		                     !blocks.back().streaming);
+		EXIT_NOT_IMPLEMENTED(channels == 0 || (flags & 4u) != 0);
+		if (blocks.empty()) {
+			accepts_blocks = (flags & 1u) != 0;
+			return OK;
+		}
+		EXIT_NOT_IMPLEMENTED(!blocks.back().streaming);
 		const auto frame_bytes = size_t(channels) * sizeof(int16_t);
 		auto&      stream      = blocks.back();
 		for (uint32_t i = 0; i < count; ++i) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

		EXIT_NOT_IMPLEMENTED(channels == 0 || (flags & 4u) != 0);
		if (blocks.empty()) {
			accepts_blocks = (flags & 1u) != 0;
			return OK;
		}
		EXIT_NOT_IMPLEMENTED(!blocks.back().streaming);
**@⁠coderabbitai[bot]** on GitHub · 2026-10-21 15:35 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1787#discussion_r4338742420) On `src/libs/ngs2.cpp` line 711 (outdated): ```diff @@ -675,6 +705,27 @@ struct Ngs2VoiceInternal { } } + int AppendStream(const uint8_t* data, uint32_t flags, uint32_t count, + const Ngs2WaveformBlock* waveform_blocks) { + EXIT_NOT_IMPLEMENTED(channels == 0 || (flags & 4u) != 0 || blocks.empty() || + !blocks.back().streaming); ``` <!-- coderabbit-ai-generated:v1 --> **🩺 Stability & Availability** | **🟡 Minor** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash git diff 4644c5292773095b8ee30483aaf6e017bba3c713 0e068c3fe20baf4d1f092ffbf1fa5db018709e46 -- src/libs/ngs2.cpp tests/Ngs2SamplerTests.cpp | sed -n '1,320p' sed -n '580,795p' src/libs/ngs2.cpp sed -n '1630,1725p' tests/Ngs2SamplerTests.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 24005 --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- symbols and callers ---' rg -n -F --glob '*.{cpp,h,hpp}' -e 'AddWaveformBlocks' -e 'Ngs2FinishBlock' -e 'ONLY_DATA' -e '0x2' src tests include 2>/dev/null || true printf '%s\n' '--- head queue/finish implementation ---' nl -ba src/libs/ngs2.cpp | sed -n '620,840p' printf '%s\n' '--- finish and PCM decode definitions ---' rg -n -F -- 'Ngs2FinishBlock' src/libs/ngs2.cpp nl -ba src/libs/ngs2.cpp | sed -n '1500,1735p' printf '%s\n' '--- relevant head tests and fixture API ---' rg -n -F --glob 'tests/Ngs2SamplerTests.cpp' -e 'QueueBlocks' -e 'ONLY_DATA' -e 'TestPcmStreamAppend' -e 'Ngs2WaveformBlock' tests/Ngs2SamplerTests.cpp printf '%s\n' '--- base implementation and tests ---' git show 4644c5292773095b8ee30483aaf6e017bba3c713:src/libs/ngs2.cpp | nl -ba | sed -n '620,810p' git show 4644c5292773095b8ee30483aaf6e017bba3c713:tests/Ngs2SamplerTests.cpp | rg -n -F -e 'QueueBlocks' -e 'Ngs2WaveformBlock' -e 'ONLY_DATA' || true ``` Repository: KytyPS5/KytyPS5 Length of output: 42695 --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- exact waveform API declarations and definitions ---' rg -n -F --glob '*.cpp' --glob '*.h' --glob '*.hpp' -e 'Ngs2VoiceAddWaveformBlocks' -e 'Ngs2AddWaveformBlocks' -e 'AddWaveformBlocks' -e 'Ngs2WaveformBlock' src include tests 2>/dev/null || true printf '%s\n' '--- flags and waveform API documentation/comments ---' rg -n -i --glob '*.cpp' --glob '*.h' --glob '*.hpp' -e 'only.?data' -e 'waveform.*block' -e 'add.*waveform' -e 'continuation' src include tests docs 2>/dev/null || true printf '%s\n' '--- head public API region around waveform calls ---' rg -n -F --glob 'src/libs/ngs2.cpp' -e 'Waveform' -e 'waveform' src/libs/ngs2.cpp | tail -80 printf '%s\n' '--- complete head test fixture and waveform tests ---' nl -ba tests/Ngs2SamplerTests.cpp | sed -n '1,190p' nl -ba tests/Ngs2SamplerTests.cpp | sed -n '1230,1380p' printf '%s\n' '--- base/head exact AddWaveformBlocks diff ---' git diff 4644c5292773095b8ee30483aaf6e017bba3c713 0e068c3fe20baf4d1f092ffbf1fa5db018709e46 --unified=80 -- src/libs/ngs2.cpp | sed -n '130,300p' ``` Repository: KytyPS5/KytyPS5 Length of output: 42155 --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- guest dispatch and result handling ---' nl -ba src/libs/ngs2.cpp | sed -n '180,255p' nl -ba src/libs/ngs2.cpp | sed -n '2560,2635p' printf '%s\n' '--- public declarations ---' nl -ba src/libs/ngs2.h | sed -n '1,90p' printf '%s\n' '--- all accepts_blocks assignments and checks ---' rg -n -F -- 'accepts_blocks' src/libs/ngs2.cpp tests/Ngs2SamplerTests.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 12795 --- </details> **Handle a late PCM stream append without aborting.** A completed PCM stream is removed from `blocks`, but `accepts_blocks` remains enabled when the stream used continuation flag `0x1`. A later guest `ONLY_DATA` request is forwarded to `AppendStream`, which then aborts because `blocks` is empty. Limit the no-op behavior to an empty queue. The ordinary-block case is not a regression because the base implementation rejected all PCM `ONLY_DATA` requests. <details> <summary>Suggested fix</summary> ```diff --- "a/src/libs/ngs2.cpp" +++ "b/src/libs/ngs2.cpp" @@ -707,8 +707,12 @@ int AppendStream(const uint8_t* data, uint32_t flags, uint32_t count, const Ngs2WaveformBlock* waveform_blocks) { - EXIT_NOT_IMPLEMENTED(channels == 0 || (flags & 4u) != 0 || blocks.empty() || - !blocks.back().streaming); + EXIT_NOT_IMPLEMENTED(channels == 0 || (flags & 4u) != 0); + if (blocks.empty()) { + accepts_blocks = (flags & 1u) != 0; + return OK; + } + EXIT_NOT_IMPLEMENTED(!blocks.back().streaming); const auto frame_bytes = size_t(channels) * sizeof(int16_t); auto& stream = blocks.back(); for (uint32_t i = 0; i < count; ++i) { ``` </details> <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. ```suggestion EXIT_NOT_IMPLEMENTED(channels == 0 || (flags & 4u) != 0); if (blocks.empty()) { accepts_blocks = (flags & 1u) != 0; return OK; } EXIT_NOT_IMPLEMENTED(!blocks.back().streaming); ``` </details> <!-- suggestion_end --> <!-- fingerprinting:phantom:medusa:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:0604cf2af30b28731caf012c --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-21 15:35 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: 30d864b1-ff59-43e5-a44d-67b151e8a819
📥 Commits

Reviewing files that changed from the base of the PR and between 4644c52927 and 0e068c3fe20baf4d1f092ffbf1fa5db018709e46.

📒 Files selected for processing: 2
  • src/libs/ngs2.cpp
  • tests/Ngs2SamplerTests.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-21 15:35 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1787#pullrequestreview-5602196880) · **reviewed** <!-- coderabbit-ai-generated:v1 --> **Actionable comments posted: 1** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `30d864b1-ff59-43e5-a44d-67b151e8a819` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 4644c5292773095b8ee30483aaf6e017bba3c713 and 0e068c3fe20baf4d1f092ffbf1fa5db018709e46. </details> <details> <summary>📒 Files selected for processing: 2</summary> * `src/libs/ngs2.cpp` * `tests/Ngs2SamplerTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=1bf74c32-dc20-4c19-8296-08ca265a571f attempt=18788871-a891-4176-bb41-a994b5adfeab batch=1/1 -->
This discussion has been locked. Commenting is limited to contributors.
No description provided.