aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE
diff options
context:
space:
mode:
authorMary <me@thog.eu>2021-09-19 12:29:19 +0200
committerGitHub <noreply@github.com>2021-09-19 12:29:19 +0200
commite17eb7bfafdd95084baea8e9f3dc77ee3f755347 (patch)
tree4982e2593a279c9e2c4906ead4d1764a9ddadb54 /Ryujinx.HLE
parentfe9d5a1981cfe43c4535b7473064c9858addb3b5 (diff)
amadeus: Update to REV10 (#2654)
* amadeus: Update to REV10 This implements all the changes made with REV10 on 13.0.0. * Address Ack's comment * Address gdkchan's comment
Diffstat (limited to 'Ryujinx.HLE')
-rw-r--r--Ryujinx.HLE/HOS/Services/Audio/AudioRenderer/AudioDevice.cs38
-rw-r--r--Ryujinx.HLE/HOS/Services/Audio/AudioRenderer/AudioDeviceServer.cs62
-rw-r--r--Ryujinx.HLE/HOS/Services/Audio/AudioRenderer/IAudioDevice.cs3
3 files changed, 76 insertions, 27 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Audio/AudioRenderer/AudioDevice.cs b/Ryujinx.HLE/HOS/Services/Audio/AudioRenderer/AudioDevice.cs
index 8ba10946..beecb0a3 100644
--- a/Ryujinx.HLE/HOS/Services/Audio/AudioRenderer/AudioDevice.cs
+++ b/Ryujinx.HLE/HOS/Services/Audio/AudioRenderer/AudioDevice.cs
@@ -107,18 +107,9 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioRenderer
return ResultCode.Success;
}
- public ResultCode GetAudioSystemMasterVolumeSetting(string name, out float systemMasterVolume)
+ public string GetActiveAudioOutputDeviceName()
{
- if (TryGetDeviceByName(out VirtualDeviceSession result, name, true))
- {
- systemMasterVolume = result.Device.MasterVolume;
- }
- else
- {
- systemMasterVolume = 0.0f;
- }
-
- return ResultCode.Success;
+ return _registry.ActiveDevice.GetOutputDeviceName();
}
public string[] ListAudioDeviceName()
@@ -132,9 +123,32 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioRenderer
string[] result = new string[deviceCount];
- for (int i = 0; i < deviceCount; i++)
+ int i = 0;
+
+ foreach (VirtualDeviceSession session in _sessions)
{
+ if (!_isUsbDeviceSupported && _sessions[i].Device.IsUsbDevice())
+ {
+ continue;
+ }
+
result[i] = _sessions[i].Device.Name;
+
+ i++;
+ }
+
+ return result;
+ }
+
+ public string[] ListAudioOutputDeviceName()
+ {
+ int deviceCount = _sessions.Length;
+
+ string[] result = new string[deviceCount];
+
+ for (int i = 0; i < deviceCount; i++)
+ {
+ result[i] = _sessions[i].Device.GetOutputDeviceName();
}
return result;
diff --git a/Ryujinx.HLE/HOS/Services/Audio/AudioRenderer/AudioDeviceServer.cs b/Ryujinx.HLE/HOS/Services/Audio/AudioRenderer/AudioDeviceServer.cs
index 87ec2f6a..1ef97ecc 100644
--- a/Ryujinx.HLE/HOS/Services/Audio/AudioRenderer/AudioDeviceServer.cs
+++ b/Ryujinx.HLE/HOS/Services/Audio/AudioRenderer/AudioDeviceServer.cs
@@ -38,8 +38,6 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioRenderer
if ((position - basePosition) + (ulong)buffer.Length > size)
{
- Logger.Error?.Print(LogClass.ServiceAudio, $"Output buffer size {size} too small!");
-
break;
}
@@ -158,8 +156,6 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioRenderer
if ((position - basePosition) + (ulong)buffer.Length > size)
{
- Logger.Error?.Print(LogClass.ServiceAudio, $"Output buffer size {size} too small!");
-
break;
}
@@ -264,23 +260,61 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioRenderer
return ResultCode.Success;
}
- [CommandHipc(13)]
- // GetAudioSystemMasterVolumeSetting(buffer<bytes, 5> name) -> f32
- public ResultCode GetAudioSystemMasterVolumeSetting(ServiceCtx context)
+ [CommandHipc(13)] // 13.0.0+
+ // GetActiveAudioOutputDeviceName() -> buffer<bytes, 6>
+ public ResultCode GetActiveAudioOutputDeviceName(ServiceCtx context)
{
- ulong position = context.Request.SendBuff[0].Position;
- ulong size = context.Request.SendBuff[0].Size;
+ string name = _impl.GetActiveAudioOutputDeviceName();
- string deviceName = MemoryHelper.ReadAsciiString(context.Memory, position, (long)size);
+ ulong position = context.Request.ReceiveBuff[0].Position;
+ ulong size = context.Request.ReceiveBuff[0].Size;
- ResultCode result = _impl.GetAudioSystemMasterVolumeSetting(deviceName, out float systemMasterVolume);
+ byte[] deviceNameBuffer = Encoding.ASCII.GetBytes(name + "\0");
- if (result == ResultCode.Success)
+ if ((ulong)deviceNameBuffer.Length <= size)
+ {
+ context.Memory.Write(position, deviceNameBuffer);
+ }
+ else
{
- context.ResponseData.Write(systemMasterVolume);
+ Logger.Error?.Print(LogClass.ServiceAudio, $"Output buffer size {size} too small!");
}
- return result;
+ return ResultCode.Success;
+ }
+
+ [CommandHipc(14)] // 13.0.0+
+ // ListAudioOutputDeviceName() -> (u32, buffer<bytes, 6>)
+ public ResultCode ListAudioOutputDeviceName(ServiceCtx context)
+ {
+ string[] deviceNames = _impl.ListAudioOutputDeviceName();
+
+ ulong position = context.Request.ReceiveBuff[0].Position;
+ ulong size = context.Request.ReceiveBuff[0].Size;
+
+ ulong basePosition = position;
+
+ int count = 0;
+
+ foreach (string name in deviceNames)
+ {
+ byte[] buffer = Encoding.ASCII.GetBytes(name);
+
+ if ((position - basePosition) + (ulong)buffer.Length > size)
+ {
+ break;
+ }
+
+ context.Memory.Write(position, buffer);
+ MemoryHelper.FillWithZeros(context.Memory, position + (ulong)buffer.Length, AudioDeviceNameSize - buffer.Length);
+
+ position += AudioDeviceNameSize;
+ count++;
+ }
+
+ context.ResponseData.Write(count);
+
+ return ResultCode.Success;
}
}
}
diff --git a/Ryujinx.HLE/HOS/Services/Audio/AudioRenderer/IAudioDevice.cs b/Ryujinx.HLE/HOS/Services/Audio/AudioRenderer/IAudioDevice.cs
index 42ea727f..1918a977 100644
--- a/Ryujinx.HLE/HOS/Services/Audio/AudioRenderer/IAudioDevice.cs
+++ b/Ryujinx.HLE/HOS/Services/Audio/AudioRenderer/IAudioDevice.cs
@@ -12,6 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioRenderer
uint GetActiveChannelCount();
KEvent QueryAudioDeviceInputEvent();
KEvent QueryAudioDeviceOutputEvent();
- ResultCode GetAudioSystemMasterVolumeSetting(string name, out float systemMasterVolume);
+ string GetActiveAudioOutputDeviceName();
+ string[] ListAudioOutputDeviceName();
}
}