audio: Fix crash due to invalid Splitter size

Fix crash caused by reading incorrect size of Splitter data.

In most games the crash doesnt happen if you have nn::audio::AudioRendererParameter VoiceCount aligned to 2, as that causes splitter data to be aligned by 0x10, but otherwise, the alignment by 0x10 done in SplitterContext->Update may exceed SplitterSize (which was previously labeled as Unknown24), causing a crash.

(Crash can be replicated by doing AudioRendererParameter.voiceCount++; in any SDK 20.X game that works, which doesn't cause crash on actual hardware)

(This patch is from a friend who makes mods.)
This commit is contained in:
Coxxs
2026-02-01 16:11:46 -06:00
committed by KeatonTheBot
parent 60c867622e
commit 9a684ff066
2 changed files with 5 additions and 1 deletions
@@ -17,7 +17,7 @@ namespace Ryujinx.Audio.Renderer.Common
public uint MixesSize; public uint MixesSize;
public uint SinksSize; public uint SinksSize;
public uint PerformanceBufferSize; public uint PerformanceBufferSize;
public uint Unknown24; public uint SplitterSize;
public uint RenderInfoSize; public uint RenderInfoSize;
#pragma warning disable IDE0051, CS0169 // Remove unused field #pragma warning disable IDE0051, CS0169 // Remove unused field
@@ -433,8 +433,12 @@ namespace Ryujinx.Audio.Renderer.Server
public ResultCode UpdateSplitter(SplitterContext context) public ResultCode UpdateSplitter(SplitterContext context)
{ {
long initialInputConsumed = _inputReader.Consumed;
if (context.Update(ref _inputReader)) if (context.Update(ref _inputReader))
{ {
_inputReader.SetConsumed(initialInputConsumed + _inputHeader.SplitterSize);
return ResultCode.Success; return ResultCode.Success;
} }