aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Horizon/Prepo
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2023-07-01 12:42:10 +0200
committerGitHub <noreply@github.com>2023-07-01 12:42:10 +0200
commit02b5c7ea89bb6aae1c214b78fb1047872382dc43 (patch)
treea115799d95dd6214afcdfa805dce2362d80382f2 /src/Ryujinx.Horizon/Prepo
parent801b71a12883f8a104c699a92a9aa997e2a6d609 (diff)
[Ryujinx.Horizon] Address dotnet-format issues (#5381)
* 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 dotnet format CA1822 warnings * 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 * Revert formatting changes for while and for-loops * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Add comments to disabled warnings * Remove a few unused parameters * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Address IDE0251 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 * Add trailing commas and fix formatting issues * Convert if-else chain to switch block * Address review feedback
Diffstat (limited to 'src/Ryujinx.Horizon/Prepo')
-rw-r--r--src/Ryujinx.Horizon/Prepo/Ipc/PrepoService.cs17
-rw-r--r--src/Ryujinx.Horizon/Prepo/PrepoIpcServer.cs12
-rw-r--r--src/Ryujinx.Horizon/Prepo/PrepoMain.cs2
-rw-r--r--src/Ryujinx.Horizon/Prepo/PrepoResult.cs4
-rw-r--r--src/Ryujinx.Horizon/Prepo/PrepoServerManager.cs4
-rw-r--r--src/Ryujinx.Horizon/Prepo/Types/PrepoPortIndex.cs4
-rw-r--r--src/Ryujinx.Horizon/Prepo/Types/PrepoServicePermissionLevel.cs10
7 files changed, 30 insertions, 23 deletions
diff --git a/src/Ryujinx.Horizon/Prepo/Ipc/PrepoService.cs b/src/Ryujinx.Horizon/Prepo/Ipc/PrepoService.cs
index e157fa56..f424b17e 100644
--- a/src/Ryujinx.Horizon/Prepo/Ipc/PrepoService.cs
+++ b/src/Ryujinx.Horizon/Prepo/Ipc/PrepoService.cs
@@ -10,6 +10,7 @@ using Ryujinx.Horizon.Sdk.Sf;
using Ryujinx.Horizon.Sdk.Sf.Hipc;
using System;
using System.Text;
+using ApplicationId = Ryujinx.Horizon.Sdk.Ncm.ApplicationId;
namespace Ryujinx.Horizon.Prepo.Ipc
{
@@ -18,14 +19,14 @@ namespace Ryujinx.Horizon.Prepo.Ipc
enum PlayReportKind
{
Normal,
- System
+ System,
}
private readonly PrepoServicePermissionLevel _permissionLevel;
private ulong _systemSessionId;
- private bool _immediateTransmissionEnabled = false;
- private bool _userAgreementCheckEnabled = true;
+ private bool _immediateTransmissionEnabled;
+ private bool _userAgreementCheckEnabled = true;
public PrepoService(PrepoServicePermissionLevel permissionLevel)
{
@@ -107,7 +108,7 @@ namespace Ryujinx.Horizon.Prepo.Ipc
}
[CmifCommand(20100)]
- public Result SaveSystemReport([Buffer(HipcBufferFlags.In | HipcBufferFlags.Pointer)] ReadOnlySpan<byte> gameRoomBuffer, Sdk.Ncm.ApplicationId applicationId, [Buffer(HipcBufferFlags.In | HipcBufferFlags.MapAlias)] ReadOnlySpan<byte> reportBuffer)
+ public Result SaveSystemReport([Buffer(HipcBufferFlags.In | HipcBufferFlags.Pointer)] ReadOnlySpan<byte> gameRoomBuffer, ApplicationId applicationId, [Buffer(HipcBufferFlags.In | HipcBufferFlags.MapAlias)] ReadOnlySpan<byte> reportBuffer)
{
if ((_permissionLevel & PrepoServicePermissionLevel.System) != 0)
{
@@ -118,7 +119,7 @@ namespace Ryujinx.Horizon.Prepo.Ipc
}
[CmifCommand(20101)]
- public Result SaveSystemReportWithUser(Uid userId, [Buffer(HipcBufferFlags.In | HipcBufferFlags.Pointer)] ReadOnlySpan<byte> gameRoomBuffer, Sdk.Ncm.ApplicationId applicationId, [Buffer(HipcBufferFlags.In | HipcBufferFlags.MapAlias)] ReadOnlySpan<byte> reportBuffer)
+ public Result SaveSystemReportWithUser(Uid userId, [Buffer(HipcBufferFlags.In | HipcBufferFlags.Pointer)] ReadOnlySpan<byte> gameRoomBuffer, ApplicationId applicationId, [Buffer(HipcBufferFlags.In | HipcBufferFlags.MapAlias)] ReadOnlySpan<byte> reportBuffer)
{
if ((_permissionLevel & PrepoServicePermissionLevel.System) != 0)
{
@@ -164,7 +165,7 @@ namespace Ryujinx.Horizon.Prepo.Ipc
return PrepoResult.PermissionDenied;
}
- private static Result ProcessPlayReport(PlayReportKind playReportKind, ReadOnlySpan<byte> gameRoomBuffer, ReadOnlySpan<byte> reportBuffer, ulong pid, Uid userId, bool withUserId = false, Sdk.Ncm.ApplicationId applicationId = default)
+ private static Result ProcessPlayReport(PlayReportKind playReportKind, ReadOnlySpan<byte> gameRoomBuffer, ReadOnlySpan<byte> reportBuffer, ulong pid, Uid userId, bool withUserId = false, ApplicationId applicationId = default)
{
if (withUserId)
{
@@ -191,7 +192,7 @@ namespace Ryujinx.Horizon.Prepo.Ipc
return PrepoResult.InvalidBufferSize;
}
- StringBuilder builder = new();
+ StringBuilder builder = new();
MessagePackObject deserializedReport = MessagePackSerializer.UnpackMessagePackObject(reportBuffer.ToArray());
builder.AppendLine();
@@ -222,4 +223,4 @@ namespace Ryujinx.Horizon.Prepo.Ipc
return Result.Success;
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Horizon/Prepo/PrepoIpcServer.cs b/src/Ryujinx.Horizon/Prepo/PrepoIpcServer.cs
index b80399ea..9c185520 100644
--- a/src/Ryujinx.Horizon/Prepo/PrepoIpcServer.cs
+++ b/src/Ryujinx.Horizon/Prepo/PrepoIpcServer.cs
@@ -6,13 +6,13 @@ namespace Ryujinx.Horizon.Prepo
{
class PrepoIpcServer
{
- private const int PrepoMaxSessionsCount = 12;
+ private const int PrepoMaxSessionsCount = 12;
private const int PrepoTotalMaxSessionsCount = PrepoMaxSessionsCount * 6;
private const int PointerBufferSize = 0x80;
- private const int MaxDomains = 64;
- private const int MaxDomainObjects = 16;
- private const int MaxPortsCount = 6;
+ private const int MaxDomains = 64;
+ private const int MaxDomainObjects = 16;
+ private const int MaxPortsCount = 6;
private static readonly ManagerOptions _prepoManagerOptions = new(PointerBufferSize, MaxDomains, MaxDomainObjects, false);
@@ -28,12 +28,14 @@ namespace Ryujinx.Horizon.Prepo
_serverManager = new PrepoServerManager(allocator, _sm, MaxPortsCount, _prepoManagerOptions, PrepoTotalMaxSessionsCount);
+#pragma warning disable IDE0055 // Disable formatting
_serverManager.RegisterServer((int)PrepoPortIndex.Admin, ServiceName.Encode("prepo:a"), PrepoMaxSessionsCount); // 1.0.0-5.1.0
_serverManager.RegisterServer((int)PrepoPortIndex.Admin2, ServiceName.Encode("prepo:a2"), PrepoMaxSessionsCount); // 6.0.0+
_serverManager.RegisterServer((int)PrepoPortIndex.Manager, ServiceName.Encode("prepo:m"), PrepoMaxSessionsCount);
_serverManager.RegisterServer((int)PrepoPortIndex.User, ServiceName.Encode("prepo:u"), PrepoMaxSessionsCount);
_serverManager.RegisterServer((int)PrepoPortIndex.System, ServiceName.Encode("prepo:s"), PrepoMaxSessionsCount);
_serverManager.RegisterServer((int)PrepoPortIndex.Debug, ServiceName.Encode("prepo:d"), PrepoMaxSessionsCount); // 1.0.0
+#pragma warning restore IDE0055
}
public void ServiceRequests()
@@ -46,4 +48,4 @@ namespace Ryujinx.Horizon.Prepo
_serverManager.Dispose();
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Horizon/Prepo/PrepoMain.cs b/src/Ryujinx.Horizon/Prepo/PrepoMain.cs
index 5ff0f53d..c311d619 100644
--- a/src/Ryujinx.Horizon/Prepo/PrepoMain.cs
+++ b/src/Ryujinx.Horizon/Prepo/PrepoMain.cs
@@ -14,4 +14,4 @@
ipcServer.Shutdown();
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Horizon/Prepo/PrepoResult.cs b/src/Ryujinx.Horizon/Prepo/PrepoResult.cs
index 12255e3d..4c6bc7a4 100644
--- a/src/Ryujinx.Horizon/Prepo/PrepoResult.cs
+++ b/src/Ryujinx.Horizon/Prepo/PrepoResult.cs
@@ -6,10 +6,12 @@ namespace Ryujinx.Horizon.Prepo
{
private const int ModuleId = 129;
+#pragma warning disable IDE0055 // Disable formatting
public static Result InvalidArgument => new(ModuleId, 1);
public static Result InvalidState => new(ModuleId, 5);
public static Result InvalidBufferSize => new(ModuleId, 9);
public static Result PermissionDenied => new(ModuleId, 90);
public static Result InvalidPid => new(ModuleId, 101);
+#pragma warning restore IDE0055
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Horizon/Prepo/PrepoServerManager.cs b/src/Ryujinx.Horizon/Prepo/PrepoServerManager.cs
index 55e4ff7d..a7936095 100644
--- a/src/Ryujinx.Horizon/Prepo/PrepoServerManager.cs
+++ b/src/Ryujinx.Horizon/Prepo/PrepoServerManager.cs
@@ -17,6 +17,7 @@ namespace Ryujinx.Horizon.Prepo
{
return (PrepoPortIndex)portIndex switch
{
+#pragma warning disable IDE0055 // Disable formatting
PrepoPortIndex.Admin => AcceptImpl(server, new PrepoService(PrepoServicePermissionLevel.Admin)),
PrepoPortIndex.Admin2 => AcceptImpl(server, new PrepoService(PrepoServicePermissionLevel.Admin)),
PrepoPortIndex.Manager => AcceptImpl(server, new PrepoService(PrepoServicePermissionLevel.Manager)),
@@ -24,7 +25,8 @@ namespace Ryujinx.Horizon.Prepo
PrepoPortIndex.System => AcceptImpl(server, new PrepoService(PrepoServicePermissionLevel.System)),
PrepoPortIndex.Debug => AcceptImpl(server, new PrepoService(PrepoServicePermissionLevel.Debug)),
_ => throw new ArgumentOutOfRangeException(nameof(portIndex)),
+#pragma warning restore IDE0055
};
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Horizon/Prepo/Types/PrepoPortIndex.cs b/src/Ryujinx.Horizon/Prepo/Types/PrepoPortIndex.cs
index f4d6b877..31c5b02d 100644
--- a/src/Ryujinx.Horizon/Prepo/Types/PrepoPortIndex.cs
+++ b/src/Ryujinx.Horizon/Prepo/Types/PrepoPortIndex.cs
@@ -7,6 +7,6 @@
Manager,
User,
System,
- Debug
+ Debug,
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Horizon/Prepo/Types/PrepoServicePermissionLevel.cs b/src/Ryujinx.Horizon/Prepo/Types/PrepoServicePermissionLevel.cs
index 8214f4b9..759c5018 100644
--- a/src/Ryujinx.Horizon/Prepo/Types/PrepoServicePermissionLevel.cs
+++ b/src/Ryujinx.Horizon/Prepo/Types/PrepoServicePermissionLevel.cs
@@ -2,10 +2,10 @@
{
enum PrepoServicePermissionLevel
{
- Admin = -1,
- User = 1,
- System = 2,
+ Admin = -1,
+ User = 1,
+ System = 2,
Manager = 6,
- Debug = unchecked((int)0x80000006)
+ Debug = unchecked((int)0x80000006),
}
-} \ No newline at end of file
+}