fix(ngs2): accept empty waveform blocks and matrix levels on a voice without a format #5660
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5660"
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 milescoviello on 2026-10-14T05:02:03Z.
What
Steins;Gate Re:Boot (PPSA36591) ends when a button is pressed at its title screen:
With temporary prints (not part of this PR), the title clears a sampler voice:
SCE_NGS2_SAMPLER_VOICE_PARAM_SETUPwith an all-zero format.SetupSampleralready accepts this and leaves the voice without a format (0 channels).ADD_WAVEFORM_BLOCKSwithnum_blocks0 and flags 0, with non-nullblocksanddata.AddWaveformBlocksrefused it because the voice has no channels.MATRIX_LEVELSfor matrix 0 withnum_levels0.SetMatrixLevelsrefused it because there are no levels.On a voice without a format, both are now accepted:
APPENDappliesRESETand theCONTINUEstate, as it would on any voice, and adds nothing.ResetSetupleaves;Render.cpptreats it as no matrix.KytyPS5's
AddWaveformBlocks, which the libSceNgs2.native debt file already cites for the sampler, does the same for no blocks: its loop adds nothing, it takesCONTINUEfor whether the voice accepts blocks, and it returns OK. It uses the channel count only to size each block.Blocks with data,
APPEND, and an empty matrix on a voice that has a format are still refused, so the existing check inNgs2Render.cpp(zero levels on a set-up sampler voice) is unchanged. What the console returns for these calls is not measured; the libSceNgs2.native debt file records the assumption and the title.ngs2_streamgainsTestNoBlocksForClearedVoice: the title's sequence passes, and a block with data,APPEND, and an empty matrix with an out-of-range id are refused on that voice.Tested
Ubuntu 24.04, GCC 13.3 (CI's compiler), Release with CI's configure flags, on
main75690a117:main'sVoice.cppand the new test,ngs2_streamfails with the title's message,AddWaveformBlocks: invalid argument. With the change it passes 5/5, and all 10ngs2_*tests pass in 3 runs.--to-inteland run on Linux (RTX 4070 Ti), with scripted pad input from 8 s:AddWaveformBlockspart it stops about 20 s in withSetMatrixLevels: invalid argument.mainwith #5153, #5425, #5140 and #5219. It stops 25 to 35 s in withAddWaveformBlocks: invalid argumenton the same calls (a sampler voice with no format,ADD_WAVEFORM_BLOCKSwith no blocks and flags 0). With theAddWaveformBlockspart of this change it keeps running for the whole 260 s run. That run did not reach the matrix-levels path.maina077a88dfit aborts withAddWaveformBlocks: invalid argument3 s after the first Enter; with this head onmaind92a8dad3, a 600 s run with 31 key presses reaches its limit with no exception, at about 59.9 FPS.-fsyntax-onlycompile ofVoice.cpphas no errors.tools/check_conventions.py --base upstream/mainpasses, andtools/pr_overlap.py --branchfinds no overlap.Not checked on a console. On Windows, only the Void Terrarium and Steins;Gate runs above.
Checklist
main; 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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-14T10:45:56Z.
A second title reaches this, plus a reference for the behaviour.
Void Terrarium (PPSA03061), Windows 11, MinGW GCC 15, Release. This is on
mainwith #5153, #5425, #5140 and #5219, which it needs to get past its title screen. I drove it with Enter (Cross) through the title screen without a display. It stops 25–35 s in withAddWaveformBlocks: invalid argument. A local log of the call showed the same shape you describe: a sampler rack0x1000voice withchannels=0 type=0x0, andADD_WAVEFORM_BLOCKSwithflags=0x0 num_blocks=0and non-nullblocksanddata. With the sameAddWaveformBlockschange, it keeps running for the whole 260 s run with key presses continuing; I didn't check by eye which screen it reaches. It didn't hit the matrix-levels path in that run.Reference: KytyPS5's
AddWaveformBlocks, which libSceNgs2.native's debt already cites for the sampler, does the same thing: with a count of 0 its loop adds nothing, it setsaccepts_blocksfromCONTINUE, and it returns OK. The channel count is used only to size each block. ItsAPPEND-style path without a decoder is not implemented there, which matches this PR still rejectingAPPENDon a voice without a format.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-14T10:46:46Z.
Thanks, that's very helpful. I added the Void Terrarium run and the KytyPS5 reference to the description.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-15T03:36:42Z.
Another title hits the same throw: Void Terrarium (PPSA03061), Windows 10, on
maina077a88df5(clean tree, no patches; freshlibs+ relinker, title relinked with it). The title renders at about 60 FPS (window titleFPS: 59.98). After an Enter key was posted to the game window (40 s into the run) it aborts:PPSA03061_rP/run_053148.errline 17what(): AddWaveformBlocks: invalid argument, line 18FATAL: abort() (SIGABRT); the throw isAddWaveformBlocksincore/libs/prx/libSceNgs2.native/src/Voice.cpp:208. A 120 s run of the same build without any key (run_050704.err, 15 lines) did not abort. I did not build #5660 on this title, so I cannot say whether it fixes this abort; I only confirm that the same message is reached by a second title. AI-assisted (Claude Code).AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-15T03:38:14Z.
Thanks for checking it on a clean
main. That's the same stop p3n1cillin reported on Void Terrarium, where theAddWaveformBlockspart of this change kept the title running for the whole 260 s.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-15T08:03:47Z.
Windows check for STEINS;GATE RE:BOOT (PPSA36591): with this change the title no longer stops on
AddWaveformBlocks: invalid argument.maina077a88df):PPSA36591_rS2/run_054343.errline 17what(): AddWaveformBlocks: invalid argument, line 18FATAL: abort() (SIGABRT); the process died 3 s after the first Enter (sent 45 s after start).maind92a8dad390af1807cc91622b924252141816a5a+ this head5a921f0ef, clean merge, tree58e18c8c8;libsrebuilt 09:51, relinker unchanged since 05:43): a 600 s run with 31 key presses (Enter, Down, Enter, Esc, Z, X, Space, every 17-19 s from +45 s, posted to the window) ran to the limit;run_095152.errhas 24 lines (counted with Python), no exception and noFATAL; the window title shows about 59.9 FPS throughout. An earlier 240 s run with seven Enter presses on the same tree (run_063136.err) did not abort either.Windows 10 (19045), MinGW-w64 GCC 15.2.0, Release. Limits: one title; I did not see the screen, so whether audio plays or the menu advances is not verified, only that the process no longer aborts; this pull request's own tests were not run; the "without" run is on
a077a88df, I did not rerund92a8dad3without this change.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T11:50:15Z.
Checked on the PR merged onto current main:
ngs2_streamfails without the change and passes with it, all libSceNgs2.native tests and the scoped ctest are green, and the Steins;Gate / Void Terrarium runs from @p3n1cillin and @xXPBSXx on Windows cover the title behaviour.Added one commit: the "NGS2 matrix levels" debt line still said a count of 0 always throws, so it now names the exception for a voice without a format. Merging once CI is green.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:08:24Z.
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)docs/dev/debt/libSceNgs2.native.mdL12-13Some 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/Voice.cppcore/libs/prx/libSceNgs2.native/src/Voice.cppdocs/dev/debt/libSceNgs2.native.md