Accept SCE_NGS2_RACK_ID_CUSTOM_MASTERING (0x4003) using the 0x508-byte
custom rack option layout without modules. Channels above NGS2_MAX_CHANNELS
(8) and non-zero module counts throw runtime_error as unsupported. Support
mastering voice control parameters 0x40030000 (setup), 0x40030004 (gain),
and 0x40030005 (output), write active mastering voices to render buffers,
and return voice state flags in sceNgs2VoiceGetState.
References #8039.
sceNgs2PanGetVolumeMatrix now returns the PS5 error codes in the PS5 check order instead of throwing, and lets NaN angles and distances through as the PS5 module does. sceNgs2PanInit gives the 7-speaker degree defaults for 0 speakers without angles, stores NaN speaker angles and leaves unused slots untouched. Inputs on which the PS5 library never returns still throw.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The PS5 libSceNgs2.native module (firmware 3.20 and 4.03) fails a play event on a voice with no setup with 0x804A8351 on every rack I tried and leaves it idle, so the guard now covers every rack and returns that code.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A sampler voice with no setup used to enter the playing state and never finish, so a title that frees its sound slots by polling sceNgs2VoiceGetStateFlags ran out of slots. The PS4 firmware 11.00 library fails the event and keeps the voice idle.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
An unsupported speaker count returns 0x804A8451, a unit angle other than 360 or 2*pi with angles returns 0x804A8450 and a null work returns 0x804A8010, leaving the work untouched, instead of throwing.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A custom submixer rack now accepts the Gain module (0x15). Its voice
parameter 0x40001500 | module index sets one linear level per channel
(37 levels, default 0), and each grain multiplies the voice's samples
by a level that ramps linearly from the previous one to the new one,
following fma-rc's reading of the PS5 12.70 module (#8039). Gain on a
custom sampler rack, whose parameter index is offset, still throws, as
do levels outside -32 to 32.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
sceNgs2RackCreate and sceNgs2RackCreateWithAllocator now return the firmware's errors for a custom rack whose buffer count is outside 1 to 4 or below the submixer's max_inputs, whose module buffer id is at or above the count, or whose submixer has more than 37 channels, and for the state sizes of the Gain, Reverb and PitchShift modules, the Reverb option size and word, and the PitchShift option word. Racks that pass these checks with one of these modules or Convolution, with more than one buffer, more than 8 channels or a submixer max_inputs other than 1 or 2 still throw, and so does sceNgs2RackQueryBufferSize for the rejected options.
A flags value above 1 returns 0x804A8463 and a null listener parameter returns 0x804A8461, both leaving the output untouched, instead of throwing.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
sceNgs2ReportRegisterHandler and sceNgs2ReportUnregisterHandler stop
being throwing stubs: they keep a registry of report handlers, so a
title that imports them can register and later drop its handler.
Register rejects a null handler with an invalid argument and returns
INVALID_OUT_ADDRESS for a null out handle, then stores the report
type, handler and user data under a freshly allocated opaque handle.
Unregister removes and frees the matching record and throws for a
handle that is not registered.
The signatures follow SharpProspero and shadPS4's ngs2_report.h, and
the 24-byte Ngs2ReportDataHeader passed to a handler is its
OrbisNgs2ReportDataHeader. No report is produced yet, so no registered
handler is ever invoked.
An index at or beyond the rack's voice count returned through
APS5_INVALID_ARG_EX, which throws and ends the process. Heretic + Hexen
(PPSA26525) creates a one-voice reverb rack, takes voice 0 and asks for
voice 1 at start-up, so it stopped at 1.5 s on
"sceNgs2RackGetVoiceHandle: invalid argument". Return 0x804A8305 and
leave the output handle untouched, after the existing null-output and
rack-handle checks. The value follows prosper's analysis of
libSceNgs2.native.sprx; shadPS4 lists 0x804A0302 for the PS4 library.
Neither is a PS5 measurement, recorded in the technical debt.
ngs2_voiceindex creates one-voice sampler, submixer, mastering and
reverb racks and a default sampler rack, and checks the error, the
untouched output, the null-output and invalid-rack codes and that the
last valid index still resolves afterwards. It aborts on main's library
with the throw above and passes with this change.
Accept SCE_NGS2_CUSTOM_MODULE_ID_USER_FX (0x1d) on custom submixer racks alongside UserFx2 (0x1f). When configuring a custom rack voice, support voice control parameter SCE_NGS2_CUSTOM_VOICE_PARAM_USER_FX (0x40001d00) to install custom submixer UserFx callbacks with user data. Run legacy UserFx callbacks during custom voice rendering and update sample presence flags accordingly.
Fixes runtime abort in Void Terrarium (PPSA03061):
terminate called after throwing an instance of 'std::runtime_error'
what(): NGS2: custom module id 0x1d is not implemented
FATAL: abort() (SIGABRT)
Closes#5055
Dead Cells (PPSA15552) calls sceNgs2VoiceGetState on custom sampler
voices with a 48-byte buffer and reads the 64-bit value at offset 16 as
a running counter. Fill it with the decoded sample count, keep the
common state flags, and return INVALID_OUT_SIZE for other sizes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implement sceNgs2GeomResetListenerParam and sceNgs2GeomResetSourceParam,
taken from #1021 and limited to the two reset functions. The Geom
structures get their real layouts. sceNgs2GeomCalcListener and
sceNgs2GeomApply stay unimplemented.
Co-Authored-By: Dextroid17 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A playing sampler voice whose waveform still accepts blocks (CONTINUE)
reported only INUSE|PLAYING after it had played every queued block, so
a title that waits for EMPTY before it reuses the voice never did.
PPSA18391 (engine: Clickteam Fusion) reads state_flags & 0x22 != 2 from
sceNgs2VoiceGetState as the end of a sound; each of its sound effects
played once and never again.
The voice now also reports EMPTY (0x20) in that state and keeps
playing, so blocks added later still play. A waveform that was closed
without CONTINUE does not report it.
A waveform block that declares samples with no data threw as not
fitting them. PPSA04867 adds such a block with flags 0x11 (data_size 0,
num_samples 16385) and terminates the process on the throw, followed by
a fully specified block under the same flags, which takes the ordinary
path. Accept flag 0x10, named SILENCE here: a dataless block under it
renders num_samples frames of silence and finishes like a complete
block, reporting its bytes through decoded_data_size. A dataless block
without the flag keeps throwing. No public reference names the flag;
the assumption is recorded in TechnicalDebt.
Co-Authored-By: Claude Code <[email protected]>
Pan follows the PS4 firmware 11.00 libSceNgs2.sprx: the speaker layout
from the init angles, then each param's angle and distance into a
volume matrix for the voice. Every param is checked before anything is
written, and angles too large to wrap throw. The pan functions are
exported from the existing Voice.cpp export block.
Co-Authored-By: Claude Opus 5.5 <[email protected]>