Adjust naming conventions and general refactoring in HLE Project (#490)
* Rename enum fields * Naming conventions * Remove unneeded ".this" * Remove unneeded semicolons * Remove unused Usings * Don't use var * Remove unneeded enum underlying types * Explicitly label class visibility * Remove unneeded @ prefixes * Remove unneeded commas * Remove unneeded if expressions * Method doesn't use unsafe code * Remove unneeded casts * Initialized objects don't need an empty constructor * Remove settings from DotSettings * Revert "Explicitly label class visibility" This reverts commit ad5eb5787cc5b27a4631cd46ef5f551c4ae95e51. * Small changes * Revert external enum renaming * Changes from feedback * Remove unneeded property setters
This commit is contained in:
parent
c86aacde76
commit
85dbb9559a
299 changed files with 12268 additions and 12276 deletions
|
@ -20,13 +20,13 @@ namespace Ryujinx.HLE.HOS.Services.Aud
|
|||
|
||||
public const int RevMagic = Rev0Magic + (Rev << 24);
|
||||
|
||||
private Dictionary<int, ServiceProcessRequest> m_Commands;
|
||||
private Dictionary<int, ServiceProcessRequest> _commands;
|
||||
|
||||
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
||||
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
|
||||
|
||||
public IAudioRendererManager()
|
||||
{
|
||||
m_Commands = new Dictionary<int, ServiceProcessRequest>()
|
||||
_commands = new Dictionary<int, ServiceProcessRequest>
|
||||
{
|
||||
{ 0, OpenAudioRenderer },
|
||||
{ 1, GetAudioRendererWorkBufferSize },
|
||||
|
@ -35,81 +35,81 @@ namespace Ryujinx.HLE.HOS.Services.Aud
|
|||
};
|
||||
}
|
||||
|
||||
public long OpenAudioRenderer(ServiceCtx Context)
|
||||
public long OpenAudioRenderer(ServiceCtx context)
|
||||
{
|
||||
IAalOutput AudioOut = Context.Device.AudioOut;
|
||||
IAalOutput audioOut = context.Device.AudioOut;
|
||||
|
||||
AudioRendererParameter Params = GetAudioRendererParameter(Context);
|
||||
AudioRendererParameter Params = GetAudioRendererParameter(context);
|
||||
|
||||
MakeObject(Context, new IAudioRenderer(
|
||||
Context.Device.System,
|
||||
Context.Memory,
|
||||
AudioOut,
|
||||
MakeObject(context, new IAudioRenderer(
|
||||
context.Device.System,
|
||||
context.Memory,
|
||||
audioOut,
|
||||
Params));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long GetAudioRendererWorkBufferSize(ServiceCtx Context)
|
||||
public long GetAudioRendererWorkBufferSize(ServiceCtx context)
|
||||
{
|
||||
AudioRendererParameter Params = GetAudioRendererParameter(Context);
|
||||
AudioRendererParameter Params = GetAudioRendererParameter(context);
|
||||
|
||||
int Revision = (Params.Revision - Rev0Magic) >> 24;
|
||||
int revision = (Params.Revision - Rev0Magic) >> 24;
|
||||
|
||||
if (Revision <= Rev)
|
||||
if (revision <= Rev)
|
||||
{
|
||||
bool IsSplitterSupported = Revision >= 3;
|
||||
bool isSplitterSupported = revision >= 3;
|
||||
|
||||
long Size;
|
||||
long size;
|
||||
|
||||
Size = IntUtils.AlignUp(Params.Unknown8 * 4, 64);
|
||||
Size += Params.MixCount * 0x400;
|
||||
Size += (Params.MixCount + 1) * 0x940;
|
||||
Size += Params.VoiceCount * 0x3F0;
|
||||
Size += IntUtils.AlignUp((Params.MixCount + 1) * 8, 16);
|
||||
Size += IntUtils.AlignUp(Params.VoiceCount * 8, 16);
|
||||
Size += IntUtils.AlignUp(
|
||||
size = IntUtils.AlignUp(Params.Unknown8 * 4, 64);
|
||||
size += Params.MixCount * 0x400;
|
||||
size += (Params.MixCount + 1) * 0x940;
|
||||
size += Params.VoiceCount * 0x3F0;
|
||||
size += IntUtils.AlignUp((Params.MixCount + 1) * 8, 16);
|
||||
size += IntUtils.AlignUp(Params.VoiceCount * 8, 16);
|
||||
size += IntUtils.AlignUp(
|
||||
((Params.SinkCount + Params.MixCount) * 0x3C0 + Params.SampleCount * 4) *
|
||||
(Params.Unknown8 + 6), 64);
|
||||
Size += (Params.SinkCount + Params.MixCount) * 0x2C0;
|
||||
Size += (Params.EffectCount + Params.VoiceCount * 4) * 0x30 + 0x50;
|
||||
size += (Params.SinkCount + Params.MixCount) * 0x2C0;
|
||||
size += (Params.EffectCount + Params.VoiceCount * 4) * 0x30 + 0x50;
|
||||
|
||||
if (IsSplitterSupported)
|
||||
if (isSplitterSupported)
|
||||
{
|
||||
Size += IntUtils.AlignUp((
|
||||
size += IntUtils.AlignUp((
|
||||
NodeStatesGetWorkBufferSize(Params.MixCount + 1) +
|
||||
EdgeMatrixGetWorkBufferSize(Params.MixCount + 1)), 16);
|
||||
|
||||
Size += Params.SplitterDestinationDataCount * 0xE0;
|
||||
Size += Params.SplitterCount * 0x20;
|
||||
Size += IntUtils.AlignUp(Params.SplitterDestinationDataCount * 4, 16);
|
||||
size += Params.SplitterDestinationDataCount * 0xE0;
|
||||
size += Params.SplitterCount * 0x20;
|
||||
size += IntUtils.AlignUp(Params.SplitterDestinationDataCount * 4, 16);
|
||||
}
|
||||
|
||||
Size = Params.EffectCount * 0x4C0 +
|
||||
size = Params.EffectCount * 0x4C0 +
|
||||
Params.SinkCount * 0x170 +
|
||||
Params.VoiceCount * 0x100 +
|
||||
IntUtils.AlignUp(Size, 64) + 0x40;
|
||||
IntUtils.AlignUp(size, 64) + 0x40;
|
||||
|
||||
if (Params.PerformanceManagerCount >= 1)
|
||||
{
|
||||
Size += (((Params.EffectCount +
|
||||
size += (((Params.EffectCount +
|
||||
Params.SinkCount +
|
||||
Params.VoiceCount +
|
||||
Params.MixCount + 1) * 16 + 0x658) *
|
||||
(Params.PerformanceManagerCount + 1) + 0x13F) & ~0x3FL;
|
||||
}
|
||||
|
||||
Size = (Size + 0x1907D) & ~0xFFFL;
|
||||
size = (size + 0x1907D) & ~0xFFFL;
|
||||
|
||||
Context.ResponseData.Write(Size);
|
||||
context.ResponseData.Write(size);
|
||||
|
||||
Logger.PrintDebug(LogClass.ServiceAudio, $"WorkBufferSize is 0x{Size:x16}.");
|
||||
Logger.PrintDebug(LogClass.ServiceAudio, $"WorkBufferSize is 0x{size:x16}.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Context.ResponseData.Write(0L);
|
||||
context.ResponseData.Write(0L);
|
||||
|
||||
Logger.PrintWarning(LogClass.ServiceAudio, $"Library Revision 0x{Params.Revision:x8} is not supported!");
|
||||
|
||||
|
@ -117,71 +117,71 @@ namespace Ryujinx.HLE.HOS.Services.Aud
|
|||
}
|
||||
}
|
||||
|
||||
private AudioRendererParameter GetAudioRendererParameter(ServiceCtx Context)
|
||||
private AudioRendererParameter GetAudioRendererParameter(ServiceCtx context)
|
||||
{
|
||||
AudioRendererParameter Params = new AudioRendererParameter();
|
||||
|
||||
Params.SampleRate = Context.RequestData.ReadInt32();
|
||||
Params.SampleCount = Context.RequestData.ReadInt32();
|
||||
Params.Unknown8 = Context.RequestData.ReadInt32();
|
||||
Params.MixCount = Context.RequestData.ReadInt32();
|
||||
Params.VoiceCount = Context.RequestData.ReadInt32();
|
||||
Params.SinkCount = Context.RequestData.ReadInt32();
|
||||
Params.EffectCount = Context.RequestData.ReadInt32();
|
||||
Params.PerformanceManagerCount = Context.RequestData.ReadInt32();
|
||||
Params.VoiceDropEnable = Context.RequestData.ReadInt32();
|
||||
Params.SplitterCount = Context.RequestData.ReadInt32();
|
||||
Params.SplitterDestinationDataCount = Context.RequestData.ReadInt32();
|
||||
Params.Unknown2C = Context.RequestData.ReadInt32();
|
||||
Params.Revision = Context.RequestData.ReadInt32();
|
||||
Params.SampleRate = context.RequestData.ReadInt32();
|
||||
Params.SampleCount = context.RequestData.ReadInt32();
|
||||
Params.Unknown8 = context.RequestData.ReadInt32();
|
||||
Params.MixCount = context.RequestData.ReadInt32();
|
||||
Params.VoiceCount = context.RequestData.ReadInt32();
|
||||
Params.SinkCount = context.RequestData.ReadInt32();
|
||||
Params.EffectCount = context.RequestData.ReadInt32();
|
||||
Params.PerformanceManagerCount = context.RequestData.ReadInt32();
|
||||
Params.VoiceDropEnable = context.RequestData.ReadInt32();
|
||||
Params.SplitterCount = context.RequestData.ReadInt32();
|
||||
Params.SplitterDestinationDataCount = context.RequestData.ReadInt32();
|
||||
Params.Unknown2C = context.RequestData.ReadInt32();
|
||||
Params.Revision = context.RequestData.ReadInt32();
|
||||
|
||||
return Params;
|
||||
}
|
||||
|
||||
private static int NodeStatesGetWorkBufferSize(int Value)
|
||||
private static int NodeStatesGetWorkBufferSize(int value)
|
||||
{
|
||||
int Result = IntUtils.AlignUp(Value, 64);
|
||||
int result = IntUtils.AlignUp(value, 64);
|
||||
|
||||
if (Result < 0)
|
||||
if (result < 0)
|
||||
{
|
||||
Result |= 7;
|
||||
result |= 7;
|
||||
}
|
||||
|
||||
return 4 * (Value * Value) + 0x12 * Value + 2 * (Result / 8);
|
||||
return 4 * (value * value) + 0x12 * value + 2 * (result / 8);
|
||||
}
|
||||
|
||||
private static int EdgeMatrixGetWorkBufferSize(int Value)
|
||||
private static int EdgeMatrixGetWorkBufferSize(int value)
|
||||
{
|
||||
int Result = IntUtils.AlignUp(Value * Value, 64);
|
||||
int result = IntUtils.AlignUp(value * value, 64);
|
||||
|
||||
if (Result < 0)
|
||||
if (result < 0)
|
||||
{
|
||||
Result |= 7;
|
||||
result |= 7;
|
||||
}
|
||||
|
||||
return Result / 8;
|
||||
return result / 8;
|
||||
}
|
||||
|
||||
// GetAudioDeviceService(nn::applet::AppletResourceUserId) -> object<nn::audio::detail::IAudioDevice>
|
||||
public long GetAudioDeviceService(ServiceCtx Context)
|
||||
public long GetAudioDeviceService(ServiceCtx context)
|
||||
{
|
||||
long AppletResourceUserId = Context.RequestData.ReadInt64();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
MakeObject(Context, new IAudioDevice(Context.Device.System));
|
||||
MakeObject(context, new IAudioDevice(context.Device.System));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// GetAudioDeviceServiceWithRevisionInfo(nn::applet::AppletResourceUserId, u32) -> object<nn::audio::detail::IAudioDevice>
|
||||
private long GetAudioDeviceServiceWithRevisionInfo(ServiceCtx Context)
|
||||
private long GetAudioDeviceServiceWithRevisionInfo(ServiceCtx context)
|
||||
{
|
||||
long AppletResourceUserId = Context.RequestData.ReadInt64();
|
||||
int RevisionInfo = Context.RequestData.ReadInt32();
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
int revisionInfo = context.RequestData.ReadInt32();
|
||||
|
||||
Logger.PrintStub(LogClass.ServiceAudio, $"Stubbed. AppletResourceUserId: {AppletResourceUserId} - " +
|
||||
$"RevisionInfo: {RevisionInfo}");
|
||||
Logger.PrintStub(LogClass.ServiceAudio, $"Stubbed. AppletResourceUserId: {appletResourceUserId} - " +
|
||||
$"RevisionInfo: {revisionInfo}");
|
||||
|
||||
return GetAudioDeviceService(Context);
|
||||
return GetAudioDeviceService(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue