mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-20 17:51:13 +02:00
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:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user