[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

@@ -15,7 +15,9 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
private readonly ITickSource _tickSource;
#pragma warning disable IDE0052 // Remove unread private member
private uint _stickyTransform;
#pragma warning restore IDE0052
private uint _nextCallbackTicket;
private uint _currentCallbackTicket;
@@ -28,9 +30,9 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
Core = core;
_tickSource = tickSource;
_stickyTransform = 0;
_callbackTicket = 0;
_nextCallbackTicket = 0;
_stickyTransform = 0;
_callbackTicket = 0;
_nextCallbackTicket = 0;
_currentCallbackTicket = 0;
}
@@ -134,7 +136,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
{
if ((width == 0 && height != 0) || (height == 0 && width != 0))
{
slot = BufferSlotArray.InvalidBufferSlot;
slot = BufferSlotArray.InvalidBufferSlot;
fence = AndroidFence.NoFence;
return Status.BadValue;
@@ -157,7 +159,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
if (status != Status.Success)
{
slot = BufferSlotArray.InvalidBufferSlot;
slot = BufferSlotArray.InvalidBufferSlot;
fence = AndroidFence.NoFence;
return status;
@@ -176,7 +178,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
if (width == 0 || height == 0)
{
width = (uint)Core.DefaultWidth;
width = (uint)Core.DefaultWidth;
height = (uint)Core.DefaultHeight;
}
@@ -190,7 +192,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
{
if (!Core.Slots[slot].IsPreallocated)
{
slot = BufferSlotArray.InvalidBufferSlot;
slot = BufferSlotArray.InvalidBufferSlot;
fence = AndroidFence.NoFence;
return Status.NoMemory;
@@ -202,7 +204,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
$"available: Width = {graphicBuffer.Width} Height = {graphicBuffer.Height} Format = {graphicBuffer.Format} Usage = {graphicBuffer.Usage:x} " +
$"requested: Width = {width} Height = {height} Format = {format} Usage = {usage:x}");
slot = BufferSlotArray.InvalidBufferSlot;
slot = BufferSlotArray.InvalidBufferSlot;
fence = AndroidFence.NoFence;
return Status.NoInit;
@@ -215,8 +217,8 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
fence = Core.Slots[slot].Fence;
Core.Slots[slot].Fence = AndroidFence.NoFence;
Core.Slots[slot].QueueTime = TimeSpanType.Zero;
Core.Slots[slot].Fence = AndroidFence.NoFence;
Core.Slots[slot].QueueTime = TimeSpanType.Zero;
Core.Slots[slot].PresentationTime = TimeSpanType.Zero;
Core.CheckSystemEventsLocked(Core.GetMaxBufferCountLocked(async));
@@ -267,7 +269,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
if (Core.IsAbandoned)
{
graphicBuffer = default;
fence = AndroidFence.NoFence;
fence = AndroidFence.NoFence;
return Status.NoInit;
}
@@ -288,13 +290,13 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
if (nextBufferSlot == BufferSlotArray.InvalidBufferSlot)
{
graphicBuffer = default;
fence = AndroidFence.NoFence;
fence = AndroidFence.NoFence;
return Status.NoMemory;
}
graphicBuffer = Core.Slots[nextBufferSlot].GraphicBuffer;
fence = Core.Slots[nextBufferSlot].Fence;
fence = Core.Slots[nextBufferSlot].Fence;
Core.FreeBufferLocked(nextBufferSlot);
@@ -326,8 +328,8 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
Core.Slots[slot].GraphicBuffer.Set(graphicBuffer);
Core.Slots[slot].BufferState = BufferState.Dequeued;
Core.Slots[slot].Fence = AndroidFence.NoFence;
Core.Slots[slot].BufferState = BufferState.Dequeued;
Core.Slots[slot].Fence = AndroidFence.NoFence;
Core.Slots[slot].RequestBufferCalled = true;
return returnFlags;
@@ -350,10 +352,10 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
return Status.BadValue;
}
BufferItem item = new BufferItem();
BufferItem item = new();
IConsumerListener frameAvailableListener = null;
IConsumerListener frameReplaceListener = null;
IConsumerListener frameReplaceListener = null;
lock (Core.Lock)
{
@@ -388,25 +390,25 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
return Status.BadValue;
}
Core.Slots[slot].Fence = input.Fence;
Core.Slots[slot].Fence = input.Fence;
Core.Slots[slot].BufferState = BufferState.Queued;
Core.FrameCounter++;
Core.Slots[slot].FrameNumber = Core.FrameCounter;
Core.Slots[slot].QueueTime = TimeSpanType.FromTimeSpan(_tickSource.ElapsedTime);
Core.Slots[slot].FrameNumber = Core.FrameCounter;
Core.Slots[slot].QueueTime = TimeSpanType.FromTimeSpan(_tickSource.ElapsedTime);
Core.Slots[slot].PresentationTime = TimeSpanType.Zero;
item.AcquireCalled = Core.Slots[slot].AcquireCalled;
item.Crop = input.Crop;
item.Transform = input.Transform;
item.AcquireCalled = Core.Slots[slot].AcquireCalled;
item.Crop = input.Crop;
item.Transform = input.Transform;
item.TransformToDisplayInverse = (input.Transform & NativeWindowTransform.InverseDisplay) == NativeWindowTransform.InverseDisplay;
item.ScalingMode = input.ScalingMode;
item.Timestamp = input.Timestamp;
item.IsAutoTimestamp = input.IsAutoTimestamp != 0;
item.SwapInterval = input.SwapInterval;
item.FrameNumber = Core.FrameCounter;
item.Slot = slot;
item.Fence = input.Fence;
item.IsDroppable = Core.DequeueBufferCannotBlock || input.Async != 0;
item.ScalingMode = input.ScalingMode;
item.Timestamp = input.Timestamp;
item.IsAutoTimestamp = input.IsAutoTimestamp != 0;
item.SwapInterval = input.SwapInterval;
item.FrameNumber = Core.FrameCounter;
item.Slot = slot;
item.Fence = input.Fence;
item.IsDroppable = Core.DequeueBufferCannotBlock || input.Async != 0;
item.GraphicBuffer.Set(Core.Slots[slot].GraphicBuffer);
item.GraphicBuffer.Object.IncrementNvMapHandleRefCount(Core.Owner);
@@ -416,8 +418,8 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
Core.BufferHistory[Core.BufferHistoryPosition] = new BufferInfo
{
FrameNumber = Core.FrameCounter,
QueueTime = Core.Slots[slot].QueueTime,
State = BufferState.Queued
QueueTime = Core.Slots[slot].QueueTime,
State = BufferState.Queued,
};
_stickyTransform = input.StickyTransform;
@@ -460,10 +462,10 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
output = new QueueBufferOutput
{
Width = (uint)Core.DefaultWidth,
Height = (uint)Core.DefaultHeight,
TransformHint = Core.TransformHint,
NumPendingBuffers = (uint)Core.Queue.Count
Width = (uint)Core.DefaultWidth,
Height = (uint)Core.DefaultHeight,
TransformHint = Core.TransformHint,
NumPendingBuffers = (uint)Core.Queue.Count,
};
if ((input.StickyTransform & 8) != 0)
@@ -506,7 +508,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
Core.Slots[slot].BufferState = BufferState.Free;
Core.Slots[slot].FrameNumber = 0;
Core.Slots[slot].Fence = fence;
Core.Slots[slot].Fence = fence;
Core.SignalDequeueEvent();
Core.SignalWaitBufferFreeEvent();
}
@@ -568,7 +570,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
return Status.BadValue;
}
Core.BufferHasBeenQueued = false;
Core.BufferHasBeenQueued = false;
Core.DequeueBufferCannotBlock = Core.ConsumerControlledByApp && producerControlledByApp;
switch (api)
@@ -578,11 +580,11 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
case NativeWindowApi.Media:
case NativeWindowApi.Camera:
Core.ProducerListener = listener;
Core.ConnectedApi = api;
Core.ConnectedApi = api;
output.Width = (uint)Core.DefaultWidth;
output.Height = (uint)Core.DefaultHeight;
output.TransformHint = Core.TransformHint;
output.Width = (uint)Core.DefaultWidth;
output.Height = (uint)Core.DefaultHeight;
output.TransformHint = Core.TransformHint;
output.NumPendingBuffers = (uint)Core.Queue.Count;
if (NxSettings.Settings.TryGetValue("nv!nvn_no_vsync_capability", out object noVSyncCapability) && (bool)noVSyncCapability)
@@ -627,7 +629,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
producerListener = Core.ProducerListener;
Core.ProducerListener = null;
Core.ConnectedApi = NativeWindowApi.NoApi;
Core.ConnectedApi = NativeWindowApi.NoApi;
Core.SignalWaitBufferFreeEvent();
Core.SignalFrameAvailableEvent();
@@ -667,13 +669,13 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
lock (Core.Lock)
{
Core.Slots[slot].BufferState = BufferState.Free;
Core.Slots[slot].Fence = AndroidFence.NoFence;
Core.Slots[slot].RequestBufferCalled = false;
Core.Slots[slot].AcquireCalled = false;
Core.Slots[slot].BufferState = BufferState.Free;
Core.Slots[slot].Fence = AndroidFence.NoFence;
Core.Slots[slot].RequestBufferCalled = false;
Core.Slots[slot].AcquireCalled = false;
Core.Slots[slot].NeedsCleanupOnRelease = false;
Core.Slots[slot].IsPreallocated = !graphicBuffer.IsNull;
Core.Slots[slot].FrameNumber = 0;
Core.Slots[slot].IsPreallocated = !graphicBuffer.IsNull;
Core.Slots[slot].FrameNumber = 0;
Core.Slots[slot].GraphicBuffer.Set(graphicBuffer);
@@ -689,8 +691,8 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
{
// NOTE: Nintendo set the default width, height and format from the GraphicBuffer..
// This is entirely wrong and should only be controlled by the consumer...
Core.DefaultWidth = graphicBuffer.Object.Width;
Core.DefaultHeight = graphicBuffer.Object.Height;
Core.DefaultWidth = graphicBuffer.Object.Width;
Core.DefaultHeight = graphicBuffer.Object.Height;
Core.DefaultBufferFormat = graphicBuffer.Object.Format;
}
else
@@ -729,7 +731,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
{
bool tryAgain = true;
freeSlot = BufferSlotArray.InvalidBufferSlot;
freeSlot = BufferSlotArray.InvalidBufferSlot;
returnStatus = Status.Success;
while (tryAgain)