feat(libSceNgs2): map waveform blocks of linear PCM and float types #8338
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8338"
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?
Imported from boykopovar/AnyPS5. Originally posted by KernelPanicNT on 2026-10-20T10:22:14Z.
What
sceNgs2CalcWaveformBlocknow maps a sample range of a linear PCM or float waveform (types 0x10 to 0x1b) to a waveform block, and returns0x804A8432for a type the module does not know. Onmainevery type other than ATRAC9 throws.Source of the behaviour. prosper's reading of the PS5
libSceNgs2.native.sprx, which gives file offsets into the module and rates everything it calls native "CONFIDENCE: HIGH (read from the disassembly and exercised by test_ngs2_waveform)". PS5 titles bind the native module, notlibSceNgs2.sprx, whose errors and block layout differ.The PCM mapping (calc_block,
0x120a5):{1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 8, 8}for 0x10..0x1b (rodata0x54d10);Around it (entry point): a null block returns
0x804A8010before anything is written, the block is zeroed before the format is read, a null format returns0x804A8431, and a type other than PCM, float, VAG (0x1c) and ATRAC9 returns0x804A8432(L395), with the block left zeroed. prosper's own test exercises the same cases.VAG keeps throwing, and ATRAC9 keeps its current mapping and checks: both are recorded as debt, with how the ATRAC9 path differs from the reading (decoder delay, zero-count blocks, 32-bit wrap, config check). Draft #5797 adds VAG parsing and decoding but does not touch this function.
Changes:
Atrac9.cpp: the bytes-per-sample table and aPcmBlockhelper (reused by the follow-up that parses PCM loops), the PCM branch before ATRAC9's channel and rate check, and0x804A8432for unknown types.ngs2_atrac9_tests, newTestCalcPcmBlock: every type 0x10..0x1b, stereo 16-bit and float cases, zero channels, no rate, the modulo-2^32 wrap of offset and size, unknown types (0x0, 0xf, 0x1d, 0x20, 0x30, 0x43) with the block zeroed, and a null format.docs/dev/debt/libSceNgs2.native.md: a new entry for VAG and the ATRAC9 differences.Tested
Linux (GitHub Codespace, 4 cores, native build of this branch on
d14a186f4):ngs2_atrac9_tests: 5/5 runs pass.Atrac9.cppfrommain,ngs2_atrac9_testsaborts at the first PCM case, whichmainrejects (NGS2 check failed at line 202); 5/5 pass again after restoring it.ctest -R ngs2_: all 13ngs2_*tests pass.Windows (fork CI, run 39403153111, this branch and an unrelated libSceSystemService branch merged into
mainatd14a186f4): build and the full test suite pass, 1734/1734.Checks:
python3 tools/check_conventions.py --base origin/mainpasses.python3 tools/pr_overlap.py --branch feat/ngs2-calc-waveform-block-pcm: reports no overlapping change. It could not compare draft #5797, which conflicts withmain; checked by hand: #5797 sendsVAGpdata to its own parser before the RIFF path and adds its debt entry at the top of the file, so it touches neither the RIFF routing, the loops norsceNgs2CalcWaveformBlock.tools/progress.py: unchanged (4246/6515 on base and head).Checklist
main(d14a186f4); no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T10:34:39Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceNgs2.native/tests/Ngs2Atrac9.cppL197, L506Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libSceNgs2.native/src/Atrac9.cppdocs/dev/debt/libSceNgs2.native.mdImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-21T12:19:37Z.
Checked the PCM/float mapping, the error order and the wrap tests against prosper's
calc_blockandcalc_waveform_block; the debt entry covers VAG and the ATRAC9 differences; merged.