Log a splitter framing fault met while the update is applied as the rest of the section left out, not as a refused update.

The review found that audio_mixer.c splitters_walk used AUDIO_REFUSE for a framing fault in both of its walks. In the
apply walk (audio_mixer_update_routing, after audio_mixer_routing_check's walk passed) such a fault can only come from
the game rewriting its input during its own RequestUpdate. The update is taken by then: it is answered 0, its voices
and effects and the splitter records before the fault are applied, and the mix section is applied after it. Yet the
log said "RequestUpdate refused with 0x5299 ...; the renderer goes on with the last update it took". SPL_FAULT now
refuses the update in the check walk as before, and in the apply walk logs the fault with "the rest of the splitter
section is left out". The same double read of the mix section by audio_mixer_mix_layout_check and
audio_mixer_update_routing stays as it is; its comment now says the check holds for the apply only because the game
does not rewrite its input during its own RequestUpdate. docs/building.md's audio_params_check paragraph names the new
case and is wrapped again at 120 columns.

Not reproduced before the change: the game's sending thread waits in the IPC call, so neither case has a known way to
happen. A new case in tests/audio_params_check calls audio_mixer_update_routing with a splitter section whose first
destination record's magic is broken after a valid update. It checks that the splitter info before the fault and the
mix section are applied, that the destination record is not, and that the one log line names the rest of the section
left out. It failed on the code before this change ("RequestUpdate refused with 0x5299: splitter destination 0 ...
not SNDD"). audio_params_check (27 refused updates, 11 left-out records, 38 effects and sinks, both strict runs),
check_content, a compile of every runtime file and -Wall -Wextra on the audio files and cfg.c with no warnings passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 19:37:45 -05:00
parent 9770d409d5
commit a40afdd86d
3 changed files with 80 additions and 40 deletions

View File

@@ -517,22 +517,24 @@ not queued; the silence before the first prefill and across a stop is not owed,
up. The render thread's own timing (`runtime/audren.c` `render_thread`) is not built by it. No game files and no audio
device.
A change to what the audio renderer does with values the game sends (`runtime/audren.c` `update_check`,
`request_update` and `audio_bad`; `runtime/audio_mixer.c` `splitters_walk`, `audio_mixer_routing_check`,
`audio_mixer_mix_layout_check`, `audio_mixer_update_effects` and the render-pass effects; `runtime/audio_effects.c`
`audio_effect_invalid`; `runtime/audio_reverb.c` `audio_reverb_invalid`) passes `python tests\audio_params_check.py`.
It builds `audren.c` and `audio_mixer.c` with the rest of the runtime stubbed and the real effect DSPs linked, and
sends hand-built RequestUpdates through `renderer_handler`. An update whose sections do not match the renderer (sizes,
magic words, overruns, the output buffer, a mix layout with a negative count or more buffers than the renderer has, a
splitter id run whose length wraps in 32 bits) answers 0x5299, a result the SDK hands back to the game (it aborts on
any result but 0x5299, 0x5499 and 0x5699), and writes no output, changes no renderer state and places no C buffers. A channel, voice or splitter
record with an id the renderer does not have, a wave buffer index of 4, a filter that is not a finite number and a
changed mix with a foreign id are left out of an update that is otherwise applied; a splitter destination id the
renderer does not have is never read (a guard entry before the destination table would make it heard). Each effect and
sink whose values the renderer cannot use is passed through or skipped in every render pass, with nothing written to
the game's rings or sink buffer, and runs again once its values are usable. Each kind is logged once and counted every
time; valid effects of every type over 20 passes leave nothing out. With `NX2NAVI_AUDIO_STRICT=1` such a value ends
the process, in two runs of their own. No game files and no audio device.
A change to what the audio renderer does with values the game sends (`runtime/audren.c` `update_check`, `request_update`
and `audio_bad`; `runtime/audio_mixer.c` `splitters_walk`, `audio_mixer_routing_check`, `audio_mixer_mix_layout_check`,
`audio_mixer_update_effects` and the render-pass effects; `runtime/audio_effects.c` `audio_effect_invalid`;
`runtime/audio_reverb.c` `audio_reverb_invalid`) passes `python tests\audio_params_check.py`. It builds `audren.c` and
`audio_mixer.c` with the rest of the runtime stubbed and the real effect DSPs linked, and sends hand-built
RequestUpdates through `renderer_handler`. An update whose sections do not match the renderer (sizes, magic words,
overruns, the output buffer, a mix layout with a negative count or more buffers than the renderer has, a splitter id run
whose length wraps in 32 bits) answers 0x5299, a result the SDK hands back to the game (it aborts on any result but
0x5299, 0x5499 and 0x5699), and writes no output, changes no renderer state and places no C buffers. A channel, voice or
splitter record with an id the renderer does not have, a wave buffer index of 4, a filter that is not a finite number
and a changed mix with a foreign id are left out of an update that is otherwise applied; a splitter destination id the
renderer does not have is never read (a guard entry before the destination table would make it heard); a splitter
section whose framing breaks between the check and the apply keeps what came before the fault and is logged as the rest
of the section left out, not as a refused update. Each effect and sink whose values the renderer cannot use is passed
through or skipped in every render pass, with nothing written to the game's rings or sink buffer, and runs again once
its values are usable. Each kind is logged once and counted every time; valid effects of every type over 20 passes leave
nothing out. With `NX2NAVI_AUDIO_STRICT=1` such a value ends the process, in two runs of their own. No game files and no
audio device.
A change to the sprint button (`runtime/sprint.c`, the set `sprint` of `recomp/patches-v111.txt`, its call in
`runtime/ov_input.c` `npad_states`) passes `python tests\sprint_check.py`, which builds `sprint.c` with the rest of the