mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 21:49:57 -04:00
Refuse or leave out the audio values the game sends that the renderer cannot use, instead of ending the game on them.
The audio renderer checked the game's RequestUpdate with about 80 rt_fatal and need() sites in audren.c, audio_mixer.c, audio_effects.c and audio_reverb.c, so a section size, a splitter or mix record or an effect setting out of range (a reverb3d whose delays add up past 0.4 s, a limiter attack outside 0 to 1, a mix buffer index past its mix, a filter coefficient that is not finite) ended the process. The tested route never reached one; dungeons and bosses were never run. Now an update whose sections do not match the renderer is refused whole with 0x5299 before anything of it is applied: the SDK's RequestUpdateAudioRenderer hands that result back to the game, which ignores it and sends its next update, where any other result makes the SDK abort. A record with an id the renderer does not have is left out of an update that is otherwise applied, a splitter destination id it does not have is stored as -1, which both render loops skip, and an effect or sink whose values cannot be used is passed through or skipped in the render pass, with every index checked before its first write. audio_bad logs the first of each kind per renderer with the game frame and counts the rest. rt_fatal stays for host allocations, OpenAudioRenderer's parameters and the checks the new ones turn into invariants. Two inputs that did not end the process before change too: a mix in use with a negative buffer count is refused (it laid the mixes after it out before buffer 0), and a limiter attack or release that is not a number passes the sound through instead of turning the mix into NaN. NX2NAVI_AUDIO_STRICT=1 (audio_strict, default 0) makes audio_bad end the process as before, for bug reports. Not reproduced before the change in the game; crafted updates reproduced the fatals. The new tests/audio_params_check sends 27 refused updates, 10 records and 38 effects and sinks the renderer cannot use through renderer_handler and runs the strict switch; 15 deliberate breakages of the change each made it fail. audio_mixer_check, cfg_rows_check, check_content, a compile of every runtime file with no new -Wall -Wextra warnings in the changed ones and the stability pass's test matrix (the two baseline environment failures only) passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -34,6 +34,10 @@ from other projects, with its license, is listed in [THIRD_PARTY_NOTICES.md](../
|
||||
|
||||
- The SDK boundary is at the `nn::*` function level: threads and synchronisation, IPC, memory, fs/RomFS, time,
|
||||
account, applet, hid, audio renderer and effects run as host code. Only `audren:u` and `sm:` are real IPC services.
|
||||
What the game sends the audio renderer never ends the process (`audren.c` `audio_bad`): an update whose sections do
|
||||
not match the renderer is refused whole with 0x5299, which the SDK hands back to the game, and a record, effect or
|
||||
sink whose values the renderer cannot use is left out, passed through or skipped, with one log line per kind.
|
||||
`NX2NAVI_AUDIO_STRICT=1` ends the process there instead, for bug reports.
|
||||
- Window, keyboard and mouse: Win32 (`gfx_window_win.c`, `input_win.c`). Gamepads and audio output: SDL3 (every
|
||||
connected gamepad is open; the game reads the one pressed last, `input.c`). Voice: libopus. Movies: a host VP9
|
||||
decoder over libvpx replaces the SDK's `movie::Decoder` (`runtime/ov_movie.c`).
|
||||
|
||||
@@ -517,6 +517,23 @@ 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, the one result the SDK hands back to the game instead
|
||||
of aborting, 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 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
|
||||
runtime stubbed and plays frames against a stand-in Link: toggle and hold on each kind of button, the states that keep
|
||||
|
||||
Reference in New Issue
Block a user