More formatting changes

This commit is contained in:
sunshineinabox 2023-08-01 18:15:49 -07:00
parent f9de553621
commit f125005511
2 changed files with 10 additions and 11 deletions

View file

@ -107,7 +107,7 @@ namespace Ryujinx.Common.SystemInfo
} }
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{ {
using (var process = new Process using var process = new Process
{ {
StartInfo = new ProcessStartInfo StartInfo = new ProcessStartInfo
{ {
@ -117,14 +117,12 @@ namespace Ryujinx.Common.SystemInfo
RedirectStandardOutput = true, RedirectStandardOutput = true,
CreateNoWindow = true, CreateNoWindow = true,
} }
}) };
{
process.Start(); process.Start();
coreCount = int.Parse(process.StandardOutput.ReadToEnd()); coreCount = int.Parse(process.StandardOutput.ReadToEnd());
process.WaitForExit(); process.WaitForExit();
} }
} }
}
catch (Exception ex) catch (Exception ex)
{ {
Logger.Error?.Print(LogClass.Application, $"An error occurred while trying to get the physical core count: {ex.Message}"); Logger.Error?.Print(LogClass.Application, $"An error occurred while trying to get the physical core count: {ex.Message}");

View file

@ -47,7 +47,7 @@ namespace Ryujinx.Common.SystemInfo
int size = Marshal.SizeOf(typeof(SystemLogicalProcessorInformation)); int size = Marshal.SizeOf(typeof(SystemLogicalProcessorInformation));
for (long offset = 0; offset + size <= buffSize; offset += size) for (long offset = 0; offset + size <= buffSize; offset += size)
{ {
IntPtr current = new IntPtr(pos + offset); IntPtr current = new(pos + offset);
SystemLogicalProcessorInformation info = Marshal.PtrToStructure<SystemLogicalProcessorInformation>(current); SystemLogicalProcessorInformation info = Marshal.PtrToStructure<SystemLogicalProcessorInformation>(current);
if (info.Relationship == LogicalProcessorRelationship.RelationProcessorCore) if (info.Relationship == LogicalProcessorRelationship.RelationProcessorCore)
@ -98,8 +98,9 @@ namespace Ryujinx.Common.SystemInfo
[return: MarshalAs(UnmanagedType.Bool)] [return: MarshalAs(UnmanagedType.Bool)]
private static partial bool GlobalMemoryStatusEx(ref MemoryStatusEx lpBuffer); private static partial bool GlobalMemoryStatusEx(ref MemoryStatusEx lpBuffer);
[DllImport("kernel32.dll", SetLastError = true)] [LibraryImport("kernel32.dll", SetLastError = true)]
private static extern bool GetLogicalProcessorInformation(IntPtr buffer, ref uint returnLength); [return: MarshalAs(UnmanagedType.Bool)]
private static partial bool GetLogicalProcessorInformation(IntPtr buffer, ref uint returnLength);
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct SystemLogicalProcessorInformation public struct SystemLogicalProcessorInformation
@ -113,7 +114,7 @@ namespace Ryujinx.Common.SystemInfo
public struct ProcessorInformationUnion public struct ProcessorInformationUnion
{ {
[FieldOffset(8)] [FieldOffset(8)]
private UInt64 Reserved2; private readonly UInt64 Reserved2;
} }
public enum LogicalProcessorRelationship public enum LogicalProcessorRelationship