Refactoring result codes (#731)
* refactoring result codes - Add a main enum who can handle some orphalin result codes and the default `ResultCode.Success` one. - Add sub-enum by services when it's needed. - Remove some empty line. - Recast all service calls to ResultCode. - Remove some unneeded static declaration. - Delete unused `NvHelper` class. * NvResult is back * Fix
This commit is contained in:
parent
4926f6523d
commit
4ad3936afd
147 changed files with 1413 additions and 1477 deletions
|
@ -5,4 +5,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
|||
public const int HostSampleRate = 48000;
|
||||
public const int HostChannelsCount = 2;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,4 +13,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
|||
public short A1;
|
||||
public short A2;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -66,40 +66,40 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
|||
|
||||
[Command(0)]
|
||||
// GetSampleRate() -> u32
|
||||
public long GetSampleRate(ServiceCtx context)
|
||||
public ResultCode GetSampleRate(ServiceCtx context)
|
||||
{
|
||||
context.ResponseData.Write(_params.SampleRate);
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(1)]
|
||||
// GetSampleCount() -> u32
|
||||
public long GetSampleCount(ServiceCtx context)
|
||||
public ResultCode GetSampleCount(ServiceCtx context)
|
||||
{
|
||||
context.ResponseData.Write(_params.SampleCount);
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(2)]
|
||||
// GetMixBufferCount() -> u32
|
||||
public long GetMixBufferCount(ServiceCtx context)
|
||||
public ResultCode GetMixBufferCount(ServiceCtx context)
|
||||
{
|
||||
context.ResponseData.Write(_params.MixCount);
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(3)]
|
||||
// GetState() -> u32
|
||||
private long GetState(ServiceCtx context)
|
||||
private ResultCode GetState(ServiceCtx context)
|
||||
{
|
||||
context.ResponseData.Write((int)_playState);
|
||||
|
||||
Logger.PrintStub(LogClass.ServiceAudio, new { State = Enum.GetName(typeof(PlayState), _playState) });
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
private void AudioCallback()
|
||||
|
@ -131,7 +131,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
|||
[Command(4)]
|
||||
// RequestUpdateAudioRenderer(buffer<nn::audio::detail::AudioRendererUpdateDataHeader, 5>)
|
||||
// -> (buffer<nn::audio::detail::AudioRendererUpdateDataHeader, 6>, buffer<nn::audio::detail::AudioRendererUpdateDataHeader, 6>)
|
||||
public long RequestUpdateAudioRenderer(ServiceCtx context)
|
||||
public ResultCode RequestUpdateAudioRenderer(ServiceCtx context)
|
||||
{
|
||||
long outputPosition = context.Request.ReceiveBuff[0].Position;
|
||||
long outputSize = context.Request.ReceiveBuff[0].Size;
|
||||
|
@ -234,34 +234,34 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
|||
writer.Write(voice.OutStatus);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(5)]
|
||||
// Start()
|
||||
public long StartAudioRenderer(ServiceCtx context)
|
||||
public ResultCode StartAudioRenderer(ServiceCtx context)
|
||||
{
|
||||
Logger.PrintStub(LogClass.ServiceAudio);
|
||||
|
||||
_playState = PlayState.Playing;
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(6)]
|
||||
// Stop()
|
||||
public long StopAudioRenderer(ServiceCtx context)
|
||||
public ResultCode StopAudioRenderer(ServiceCtx context)
|
||||
{
|
||||
Logger.PrintStub(LogClass.ServiceAudio);
|
||||
|
||||
_playState = PlayState.Stopped;
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(7)]
|
||||
// QuerySystemEvent() -> handle<copy, event>
|
||||
public long QuerySystemEvent(ServiceCtx context)
|
||||
public ResultCode QuerySystemEvent(ServiceCtx context)
|
||||
{
|
||||
if (context.Process.HandleTable.GenerateHandle(_updateEvent.ReadableEvent, out int handle) != KernelResult.Success)
|
||||
{
|
||||
|
@ -270,7 +270,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
|||
|
||||
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
private AdpcmDecoderContext GetAdpcmDecoderContext(long position, long size)
|
||||
|
|
|
@ -9,4 +9,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
|||
OutStatus.State = MemoryPoolState.Detached;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,4 +11,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
|||
public int Unknown14;
|
||||
public long Unknown18;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,4 +9,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
|||
public int Unknown14;
|
||||
public long Unknown18;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,4 +10,4 @@
|
|||
Attached = 5,
|
||||
Released = 6
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,4 +6,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
|||
Stopped = 1,
|
||||
Paused = 2
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,4 +19,4 @@
|
|||
public int Unknown38;
|
||||
public int TotalSize;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,4 +7,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
|||
{
|
||||
// ???
|
||||
}
|
||||
}
|
||||
}
|
|
@ -196,4 +196,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
|||
_bufferReload = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -46,4 +46,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
|||
public WaveBuffer WaveBuffer2;
|
||||
public WaveBuffer WaveBuffer3;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,4 +9,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
|||
public int PlayedWaveBuffersCount;
|
||||
public int VoiceDropsCount; //?
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,4 +17,4 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
|||
public long AdpcmLoopContextSize;
|
||||
public long Unknown30;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue