mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-27 23:32:04 +00:00
add a new Method for OpenAudioOut & OpenAudioOutAuto
This commit is contained in:
parent
4397049c6a
commit
e40db09bed
1 changed files with 50 additions and 86 deletions
|
@ -35,13 +35,58 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
|
|||
}
|
||||
|
||||
public long OpenAudioOut(ServiceCtx Context)
|
||||
{
|
||||
OpenAudioOutMethod(Context, Context.Request.SendBuff[0].Position, Context.Request.SendBuff[0].Size,
|
||||
Context.Request.ReceiveBuff[0].Position, Context.Request.ReceiveBuff[0].Size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long ListAudioOutsAuto(ServiceCtx Context)
|
||||
{
|
||||
ListAudioOutsMethod(Context, Context.Request.GetBufferType0x22().Position, Context.Request.GetBufferType0x22().Size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long OpenAudioOutAuto(ServiceCtx Context)
|
||||
{
|
||||
OpenAudioOutMethod(Context, Context.Request.GetBufferType0x21().Position, Context.Request.GetBufferType0x21().Size,
|
||||
Context.Request.GetBufferType0x22().Position, Context.Request.GetBufferType0x22().Size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long ListAudioOutsMethod(ServiceCtx Context, long Position, long Size)
|
||||
{
|
||||
int NameCount = 0;
|
||||
|
||||
byte[] DeviceNameBuffer = Encoding.ASCII.GetBytes(DefaultAudioOutput + "\0");
|
||||
|
||||
if ((ulong)DeviceNameBuffer.Length <= (ulong)Size)
|
||||
{
|
||||
Context.Memory.WriteBytes(Position, DeviceNameBuffer);
|
||||
|
||||
NameCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Context.Ns.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {Size} too small!");
|
||||
}
|
||||
|
||||
Context.ResponseData.Write(NameCount);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long OpenAudioOutMethod(ServiceCtx Context, long SendPosition, long SendSize, long ReceivePosition, long ReceiveSize)
|
||||
{
|
||||
IAalOutput AudioOut = Context.Ns.AudioOut;
|
||||
|
||||
string DeviceName = AMemoryHelper.ReadAsciiString(
|
||||
Context.Memory,
|
||||
Context.Request.SendBuff[0].Position,
|
||||
Context.Request.SendBuff[0].Size
|
||||
SendPosition,
|
||||
SendSize
|
||||
);
|
||||
|
||||
if (DeviceName == string.Empty)
|
||||
|
@ -49,18 +94,15 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
|
|||
DeviceName = DefaultAudioOutput;
|
||||
}
|
||||
|
||||
long Position = Context.Request.ReceiveBuff[0].Position;
|
||||
long Size = Context.Request.ReceiveBuff[0].Size;
|
||||
|
||||
byte[] DeviceNameBuffer = Encoding.ASCII.GetBytes(DeviceName + "\0");
|
||||
|
||||
if ((ulong)DeviceNameBuffer.Length <= (ulong)Size)
|
||||
if ((ulong)DeviceNameBuffer.Length <= (ulong)ReceiveSize)
|
||||
{
|
||||
Context.Memory.WriteBytes(Position, DeviceNameBuffer);
|
||||
Context.Memory.WriteBytes(ReceivePosition, DeviceNameBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
Context.Ns.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {Size} too small!");
|
||||
Context.Ns.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {ReceiveSize} too small!");
|
||||
}
|
||||
|
||||
|
||||
|
@ -97,83 +139,5 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long ListAudioOutsAuto(ServiceCtx Context)
|
||||
{
|
||||
ListAudioOutsMethod(Context, Context.Request.GetBufferType0x22().Position, Context.Request.GetBufferType0x22().Size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long OpenAudioOutAuto(ServiceCtx Context)
|
||||
{
|
||||
IAalOutput AudioOut = Context.Ns.AudioOut;
|
||||
|
||||
string DeviceName = AMemoryHelper.ReadAsciiString(
|
||||
Context.Memory,
|
||||
Context.Request.GetBufferType0x21().Position,
|
||||
Context.Request.GetBufferType0x21().Size
|
||||
);
|
||||
|
||||
if (DeviceName == string.Empty)
|
||||
{
|
||||
DeviceName = DefaultAudioOutput;
|
||||
}
|
||||
|
||||
long Position = Context.Request.GetBufferType0x22().Position;
|
||||
long Size = Context.Request.GetBufferType0x22().Size;
|
||||
|
||||
byte[] DeviceNameBuffer = Encoding.ASCII.GetBytes(DeviceName + "\0");
|
||||
|
||||
if ((ulong)DeviceNameBuffer.Length <= (ulong)Size)
|
||||
{
|
||||
Context.Memory.WriteBytes(Position, DeviceNameBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
Context.Ns.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {Size} too small!");
|
||||
}
|
||||
|
||||
int AudioParams1 = Context.RequestData.ReadInt32();
|
||||
int AudioParams2 = Context.RequestData.ReadInt32();
|
||||
int AudioParams3 = Context.RequestData.ReadInt32();
|
||||
int AudioParams4 = Context.RequestData.ReadInt32();
|
||||
|
||||
KEvent ReleaseEvent = new KEvent();
|
||||
|
||||
ReleaseCallback Callback = () =>
|
||||
{
|
||||
ReleaseEvent.WaitEvent.Set();
|
||||
};
|
||||
|
||||
//TODO: add makeobject (object currently unknown)
|
||||
|
||||
Context.ResponseData.Write(AudioParams1);
|
||||
Context.ResponseData.Write(AudioParams2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long ListAudioOutsMethod(ServiceCtx Context, long Position, long Size)
|
||||
{
|
||||
int NameCount = 0;
|
||||
|
||||
byte[] DeviceNameBuffer = Encoding.ASCII.GetBytes(DefaultAudioOutput + "\0");
|
||||
|
||||
if ((ulong)DeviceNameBuffer.Length <= (ulong)Size)
|
||||
{
|
||||
Context.Memory.WriteBytes(Position, DeviceNameBuffer);
|
||||
|
||||
NameCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Context.Ns.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {Size} too small!");
|
||||
}
|
||||
|
||||
Context.ResponseData.Write(NameCount);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue