feat(ngs2): decode complete HE-VAG waveform blocks #5797

Closed
mohdfaour03 wants to merge 1 commit from upstream-pr/5797 into main
mohdfaour03 commented 2026-10-14 11:28:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mohdfaour03 on 2026-10-14T11:28:11Z.


What

Add complete-block HE-VAG support to both NGS2 libraries, targeting the missing game-start audio reported for Steins;Gate Re:Boot (PPSA36591) in #5677. VAGp waveform parsing now recognizes HE-VAG headers, and the sampler decodes interleaved channels into PCM for the existing renderer, including sample skips and block repeats.

Build vgmstream's HE-VAG decoder from a pinned submodule and include its license in release archives. Unsupported embedded loops, streaming append, and nonzero codec configuration throw. The library debt document records the remaining format and runtime limitations.

This is a draft pending actual-title playback validation. Tests use synthetic audio; I have not run PPSA36591 and am not claiming that the title is fixed. Complete submitted blocks are decoded eagerly, with decoder history retained within each block and reset between blocks. Console rounding, byte-position semantics, and cross-block continuation still need validation.

Tested

Windows, GCC 15.2, Release, full-build CMake configuration with BUILD_TESTING enabled:

  • Built both NGS2 libraries and their test dependencies. All 11 ngs2_ CTest tests passed, including the new HE-VAG parser and renderer regression test.
  • Synthetic fixtures cover mono/stereo metadata, malformed headers, file offsets, skipped samples, repeats, silence flags, four-tap prediction, history across frames within a block, and rejected unsupported settings.
  • Release packaging tests: 18 passed, 2 skipped; ZIP and tar archives contain the decoder license.
  • Successfully NID-patched the built libc, kernel, and both NGS2 PRX artifacts. No game execution was performed with those artifacts.
  • Branch conventions and whitespace checks passed. Full repository build/test suite, Linux, hardware audio comparison, and game playback were not run.

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 under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none (PPSA36591 playback remains unverified)
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4857162787 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5797). Originally posted by [mohdfaour03](https://github.com/mohdfaour03) on 2026-10-14T11:28:11Z. --- ### What Add complete-block HE-VAG support to both NGS2 libraries, targeting the missing game-start audio reported for Steins;Gate Re:Boot (PPSA36591) in #5677. VAGp waveform parsing now recognizes HE-VAG headers, and the sampler decodes interleaved channels into PCM for the existing renderer, including sample skips and block repeats. Build vgmstream's HE-VAG decoder from a pinned submodule and include its license in release archives. Unsupported embedded loops, streaming append, and nonzero codec configuration throw. The library debt document records the remaining format and runtime limitations. This is a draft pending actual-title playback validation. Tests use synthetic audio; I have not run PPSA36591 and am not claiming that the title is fixed. Complete submitted blocks are decoded eagerly, with decoder history retained within each block and reset between blocks. Console rounding, byte-position semantics, and cross-block continuation still need validation. ### Tested Windows, GCC 15.2, Release, full-build CMake configuration with BUILD_TESTING enabled: - Built both NGS2 libraries and their test dependencies. All 11 `ngs2_` CTest tests passed, including the new HE-VAG parser and renderer regression test. - Synthetic fixtures cover mono/stereo metadata, malformed headers, file offsets, skipped samples, repeats, silence flags, four-tap prediction, history across frames within a block, and rejected unsupported settings. - Release packaging tests: 18 passed, 2 skipped; ZIP and tar archives contain the decoder license. - Successfully NID-patched the built libc, kernel, and both NGS2 PRX artifacts. No game execution was performed with those artifacts. - Branch conventions and whitespace checks passed. Full repository build/test suite, Linux, hardware audio comparison, and game playback were not run. ### Checklist - [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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none (PPSA36591 playback remains unverified) - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-14 13:31:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T13:31:52Z.


I checked the eligibility failure log: this run stopped on a GitHub API 503 while fetching PR #5797, so it does not report a source or mergeability failure. A rerun should clarify eligibility. The overlap bot also flags #5835 because both branches edit .gitmodules; they appear to add separate submodules, so the conflict is file-level and whichever merges second may need a rebase.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6169548841 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5797#issuecomment-6169548841). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-14T13:31:52Z. --- I checked the eligibility failure log: this run stopped on a GitHub API 503 while fetching PR #5797, so it does not report a source or mergeability failure. A rerun should clarify eligibility. The overlap bot also flags #5835 because both branches edit `.gitmodules`; they appear to add separate submodules, so the conflict is file-level and whichever merges second may need a rebase.
milescoviello commented 2026-10-14 19:44:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-14T19:44:47Z.


A run of PPSA36591 with this branch, since the description asks for one: Steins;Gate Re:Boot 01.002.000, relinked with --to-intel, on Linux (Ubuntu 24.04, GCC 13.3, Release). The build is main 358e218a4 with this head (837e1b32a) merged, plus #5660, without which the title's empty waveform blocks fail before it gets this far, and a temporary log in Ngs2ParseHevag and Ngs2DecodeHevag that is not part of either PR.

In 150 s, going from the title screen into the menus with pad input, the title submits 22 HE-VAG waveforms, all VAGp version 0x20001 at 48 kHz, in four distinct shapes:

waveforms channels data bytes samples decoded peak nonzero decoded samples
1 2 152,896 133,784 27,955 250,605 of 267,568
11 2 82,528 72,212 15,378 141,294 of 144,424
8 2 80,320 70,280 22,931 130,610 of 140,560
2 1 1,904 3,332 11,703 2,920 of 3,332

Every one parses and decodes to non-silent PCM, and none reaches the alternate-header, embedded-loop or invalid-frame throws. The run lasted the full 150 s with no NGS2 error. I can't say from this whether the output matches the console sample for sample, only that the title's waveforms take the complete-block path and decode.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6176878282 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5797#issuecomment-6176878282). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-14T19:44:47Z. --- A run of PPSA36591 with this branch, since the description asks for one: Steins;Gate Re:Boot 01.002.000, relinked with `--to-intel`, on Linux (Ubuntu 24.04, GCC 13.3, Release). The build is `main` 358e218a4 with this head (837e1b32a) merged, plus #5660, without which the title's empty waveform blocks fail before it gets this far, and a temporary log in `Ngs2ParseHevag` and `Ngs2DecodeHevag` that is not part of either PR. In 150 s, going from the title screen into the menus with pad input, the title submits 22 HE-VAG waveforms, all VAGp version 0x20001 at 48 kHz, in four distinct shapes: | waveforms | channels | data bytes | samples | decoded peak | nonzero decoded samples | |---|---|---|---|---|---| | 1 | 2 | 152,896 | 133,784 | 27,955 | 250,605 of 267,568 | | 11 | 2 | 82,528 | 72,212 | 15,378 | 141,294 of 144,424 | | 8 | 2 | 80,320 | 70,280 | 22,931 | 130,610 of 140,560 | | 2 | 1 | 1,904 | 3,332 | 11,703 | 2,920 of 3,332 | Every one parses and decodes to non-silent PCM, and none reaches the alternate-header, embedded-loop or invalid-frame throws. The run lasted the full 150 s with no NGS2 error. I can't say from this whether the output matches the console sample for sample, only that the title's waveforms take the complete-block path and decode. AI-assisted: yes

Pull request closed

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!5797
No description provided.