[Ryujinx.HLE] Address dotnet-format issues (#5380)

* dotnet format style --severity info

Some changes were manually reverted.

* dotnet format analyzers --serverity info

Some changes have been minimally adapted.

* Restore a few unused methods and variables

* Silence dotnet format IDE0060 warnings

* Silence dotnet format IDE0052 warnings

* Address or silence dotnet format IDE1006 warnings

* Address dotnet format CA1816 warnings

* Address or silence dotnet format CA2208 warnings

* Address or silence dotnet format CA1806 and a few CA1854 warnings

* Address dotnet format CA2211 warnings

* Address dotnet format CA1822 warnings

* Address or silence dotnet format CA1069 warnings

* Make dotnet format succeed in style mode

* Address or silence dotnet format CA2211 warnings

* Address review comments

* Address dotnet format CA2208 warnings properly

* Make ProcessResult readonly

* Address most dotnet format whitespace warnings

* Apply dotnet format whitespace formatting

A few of them have been manually reverted and the corresponding warning was silenced

* Add previously silenced warnings back

I have no clue how these disappeared

* Revert formatting changes for while and for-loops

* Format if-blocks correctly

* Run dotnet format style after rebase

* Run dotnet format whitespace after rebase

* Run dotnet format style after rebase

* Run dotnet format analyzers after rebase

* Run dotnet format after rebase and remove unused usings

- analyzers
- style
- whitespace

* Disable 'prefer switch expression' rule

* Add comments to disabled warnings

* Fix a few disabled warnings

* Fix naming rule violation, Convert shader properties to auto-property and convert values to const

* Simplify properties and array initialization, Use const when possible, Remove trailing commas

* Start working on disabled warnings

* Fix and silence a few dotnet-format warnings again

* Run dotnet format after rebase

* Use using declaration instead of block syntax

* Address IDE0251 warnings

* Address a few disabled IDE0060 warnings

* Silence IDE0060 in .editorconfig

* Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas"

This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e.

* dotnet format whitespace after rebase

* First dotnet format pass

* Fix naming rule violations

* Fix typo

* Add trailing commas, use targeted new and use array initializer

* Fix build issues

* Fix remaining build issues

* Remove SuppressMessage for CA1069 where possible

* Address dotnet format issues

* Address formatting issues

Co-authored-by: Ac_K <acoustik666@gmail.com>

* Add GetHashCode implementation for RenderingSurfaceInfo

* Explicitly silence CA1822 for every affected method in Syscall

* Address formatting issues in Demangler.cs

* Address review feedback

Co-authored-by: Ac_K <acoustik666@gmail.com>

* Revert marking service methods as static

* Next dotnet format pass

* Address review feedback

---------

Co-authored-by: Ac_K <acoustik666@gmail.com>
This commit is contained in:
TSRBerry
2023-07-16 19:31:14 +02:00
committed by GitHub
parent fec8291c17
commit 326749498b
1015 changed files with 8173 additions and 7615 deletions

View File

@@ -11,11 +11,11 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
class IAddOnContentManager : IpcService
{
private readonly KEvent _addOnContentListChangedEvent;
private int _addOnContentListChangedEventHandle;
private int _addOnContentListChangedEventHandle;
private ulong _addOnContentBaseId;
private List<ulong> _mountedAocTitleIds = new List<ulong>();
private readonly List<ulong> _mountedAocTitleIds = new();
public IAddOnContentManager(ServiceCtx context)
{
@@ -44,7 +44,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// CountAddOnContent(pid) -> u32
public ResultCode CountAddOnContent(ServiceCtx context)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pid = context.Request.HandleDesc.PId;
#pragma warning restore IDE0059
// NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId.
@@ -55,7 +57,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// ListAddOnContent(u32 start_index, u32 buffer_size, pid) -> (u32 count, buffer<u32>)
public ResultCode ListAddOnContent(ServiceCtx context)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pid = context.Request.HandleDesc.PId;
#pragma warning restore IDE0059
// NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId.
@@ -75,7 +79,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// GetAddOnContentBaseId(pid) -> u64
public ResultCode GetAddOnContentBaseId(ServiceCtx context)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pid = context.Request.HandleDesc.PId;
#pragma warning restore IDE0059
// NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId.
@@ -95,7 +101,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// PrepareAddOnContent(u32 index, pid)
public ResultCode PrepareAddOnContent(ServiceCtx context)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pid = context.Request.HandleDesc.PId;
#pragma warning restore IDE0059
// NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId.
@@ -123,7 +131,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// GetAddOnContentListChangedEventWithProcessId(pid) -> handle<copy>
public ResultCode GetAddOnContentListChangedEventWithProcessId(ServiceCtx context)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pid = context.Request.HandleDesc.PId;
#pragma warning restore IDE0059
// NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId.
@@ -142,7 +152,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// NotifyMountAddOnContent(pid, u64 title_id)
public ResultCode NotifyMountAddOnContent(ServiceCtx context)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pid = context.Request.HandleDesc.PId;
#pragma warning restore IDE0059
// NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId.
@@ -160,7 +172,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// NotifyUnmountAddOnContent(pid, u64 title_id)
public ResultCode NotifyUnmountAddOnContent(ServiceCtx context)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pid = context.Request.HandleDesc.PId;
#pragma warning restore IDE0059
// NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId.
@@ -175,7 +189,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// CheckAddOnContentMountStatus(pid)
public ResultCode CheckAddOnContentMountStatus(ServiceCtx context)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong pid = context.Request.HandleDesc.PId;
#pragma warning restore IDE0059
// NOTE: Service call arp:r GetApplicationLaunchProperty to get TitleId using the PId.
// Then it does some internal checks and returns InvalidBufferSize if they fail.
@@ -239,10 +255,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// NOTE: Service call sys:set GetQuestFlag and store it internally.
// If QuestFlag is true, counts some extra titles.
uint startIndex = context.RequestData.ReadUInt32();
uint indexNumber = context.RequestData.ReadUInt32();
uint startIndex = context.RequestData.ReadUInt32();
uint indexNumber = context.RequestData.ReadUInt32();
ulong bufferPosition = context.Request.ReceiveBuff[0].Position;
ulong bufferSize = context.Request.ReceiveBuff[0].Size;
ulong bufferSize = context.Request.ReceiveBuff[0].Size;
// TODO: This should use _addOnContentBaseId;
uint aocTotalCount = (uint)context.Device.System.ContentManager.GetAocCount();
@@ -343,4 +359,4 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
return ((ulong)errorCode & 0x1FF | ((((ulong)errorCode >> 9) & 0x1FFF) << 32)) + 2000;
}
}
}
}

View File

@@ -4,4 +4,4 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
{
public IContentsServiceManager() { }
}
}
}

View File

@@ -19,9 +19,9 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
// SetDefaultDeliveryTarget(pid, buffer<bytes, 5> unknown)
public ResultCode SetDefaultDeliveryTarget(ServiceCtx context)
{
ulong inBufferPosition = context.Request.SendBuff[0].Position;
ulong inBufferSize = context.Request.SendBuff[0].Size;
byte[] buffer = new byte[inBufferSize];
ulong inBufferPosition = context.Request.SendBuff[0].Position;
ulong inBufferSize = context.Request.SendBuff[0].Size;
byte[] buffer = new byte[inBufferSize];
context.Memory.Read(inBufferPosition, buffer);
@@ -65,4 +65,4 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
return ResultCode.Success;
}
}
}
}

View File

@@ -2,12 +2,12 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
{
enum ResultCode
{
ModuleId = 166,
ModuleId = 166,
ErrorCodeShift = 9,
Success = 0,
InvalidBufferSize = (200 << ErrorCodeShift) | ModuleId,
InvalidPid = (300 << ErrorCodeShift) | ModuleId
InvalidPid = (300 << ErrorCodeShift) | ModuleId,
}
}
}

View File

@@ -1,6 +1,5 @@
using LibHac.Ns;
using Ryujinx.Common.Utilities;
using System;
namespace Ryujinx.HLE.HOS.Services.Ns
{
@@ -13,8 +12,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns
// GetApplicationControlData(u8, u64) -> (unknown<4>, buffer<unknown, 6>)
public ResultCode GetApplicationControlData(ServiceCtx context)
{
byte source = (byte)context.RequestData.ReadInt64();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
byte source = (byte)context.RequestData.ReadInt64();
ulong titleId = context.RequestData.ReadUInt64();
#pragma warning restore IDE0059
ulong position = context.Request.ReceiveBuff[0].Position;
@@ -25,4 +26,4 @@ namespace Ryujinx.HLE.HOS.Services.Ns
return ResultCode.Success;
}
}
}
}

View File

@@ -5,4 +5,4 @@ namespace Ryujinx.HLE.HOS.Services.Ns
{
public IDevelopInterface(ServiceCtx context) { }
}
}
}

View File

@@ -11,8 +11,10 @@ namespace Ryujinx.HLE.HOS.Services.Ns
// GetApplicationControlData(u8, u64) -> (unknown<4>, buffer<unknown, 6>)
public ResultCode GetApplicationControlData(ServiceCtx context)
{
#pragma warning disable IDE0059 // Remove unnecessary value assignment
byte source = (byte)context.RequestData.ReadInt64();
ulong titleId = context.RequestData.ReadUInt64();
#pragma warning restore IDE0059
ulong position = context.Request.ReceiveBuff[0].Position;

View File

@@ -27,4 +27,4 @@ namespace Ryujinx.HLE.HOS.Services.Ns
return ResultCode.Success;
}
}
}
}

View File

@@ -5,4 +5,4 @@ namespace Ryujinx.HLE.HOS.Services.Ns
{
public ISystemUpdateInterface(ServiceCtx context) { }
}
}
}

View File

@@ -5,4 +5,4 @@ namespace Ryujinx.HLE.HOS.Services.Ns
{
public IVulnerabilityManagerInterface(ServiceCtx context) { }
}
}
}