diff --git a/src/Ryujinx.Common/SystemInfo/SystemInfo.cs b/src/Ryujinx.Common/SystemInfo/SystemInfo.cs index daa4dd43d..b7fb32f1f 100644 --- a/src/Ryujinx.Common/SystemInfo/SystemInfo.cs +++ b/src/Ryujinx.Common/SystemInfo/SystemInfo.cs @@ -107,7 +107,7 @@ namespace Ryujinx.Common.SystemInfo } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { - using (var process = new Process + using var process = new Process { StartInfo = new ProcessStartInfo { @@ -117,12 +117,10 @@ namespace Ryujinx.Common.SystemInfo RedirectStandardOutput = true, CreateNoWindow = true, } - }) - { - process.Start(); - coreCount = int.Parse(process.StandardOutput.ReadToEnd()); - process.WaitForExit(); - } + }; + process.Start(); + coreCount = int.Parse(process.StandardOutput.ReadToEnd()); + process.WaitForExit(); } } catch (Exception ex) diff --git a/src/Ryujinx.Common/SystemInfo/WindowsSystemInfo.cs b/src/Ryujinx.Common/SystemInfo/WindowsSystemInfo.cs index 91f9375cc..dfd33ab83 100644 --- a/src/Ryujinx.Common/SystemInfo/WindowsSystemInfo.cs +++ b/src/Ryujinx.Common/SystemInfo/WindowsSystemInfo.cs @@ -47,7 +47,7 @@ namespace Ryujinx.Common.SystemInfo int size = Marshal.SizeOf(typeof(SystemLogicalProcessorInformation)); for (long offset = 0; offset + size <= buffSize; offset += size) { - IntPtr current = new IntPtr(pos + offset); + IntPtr current = new(pos + offset); SystemLogicalProcessorInformation info = Marshal.PtrToStructure(current); if (info.Relationship == LogicalProcessorRelationship.RelationProcessorCore) @@ -98,8 +98,9 @@ namespace Ryujinx.Common.SystemInfo [return: MarshalAs(UnmanagedType.Bool)] private static partial bool GlobalMemoryStatusEx(ref MemoryStatusEx lpBuffer); - [DllImport("kernel32.dll", SetLastError = true)] - private static extern bool GetLogicalProcessorInformation(IntPtr buffer, ref uint returnLength); + [LibraryImport("kernel32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static partial bool GetLogicalProcessorInformation(IntPtr buffer, ref uint returnLength); [StructLayout(LayoutKind.Sequential)] public struct SystemLogicalProcessorInformation @@ -113,7 +114,7 @@ namespace Ryujinx.Common.SystemInfo public struct ProcessorInformationUnion { [FieldOffset(8)] - private UInt64 Reserved2; + private readonly UInt64 Reserved2; } public enum LogicalProcessorRelationship