mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-20 08:34:16 +00:00
a33dc2f491
* Logger class changes only Now compile-time checking is possible with the help of Nullable Value types. * Misc formatting * Manual optimizations PrintGuestLog PrintGuestStackTrace Surfaceflinger DequeueBuffer * Reduce SendVibrationXX log level to Debug * Add Notice log level This level is always enabled and used to print system info, etc... Also, rewrite LogColor to switch expression as colors are static * Unify unhandled exception event handlers * Print enabled LogLevels during init * Re-add App Exit disposes in proper order nit: switch case spacing * Revert PrintGuestStackTrace to Info logs due to #1407 PrintGuestStackTrace is now called in some critical error handlers so revert to old behavior as KThread isn't part of Guest. * Batch replace Logger statements
46 lines
No EOL
1.4 KiB
C#
46 lines
No EOL
1.4 KiB
C#
using Ryujinx.Common.Logging;
|
|
using System;
|
|
using System.Management;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace Ryujinx.Common.SystemInfo
|
|
{
|
|
internal class WindowsSysteminfo : SystemInfo
|
|
{
|
|
public override string CpuName { get; }
|
|
public override ulong RamSize { get; }
|
|
|
|
public WindowsSysteminfo()
|
|
{
|
|
bool wmiNotAvailable = false;
|
|
|
|
try
|
|
{
|
|
foreach (ManagementBaseObject mObject in new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_Processor").Get())
|
|
{
|
|
CpuName = mObject["Name"].ToString();
|
|
}
|
|
|
|
foreach (ManagementBaseObject mObject in new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_OperatingSystem").Get())
|
|
{
|
|
RamSize = ulong.Parse(mObject["TotalVisibleMemorySize"].ToString()) * 1024;
|
|
}
|
|
}
|
|
catch (PlatformNotSupportedException)
|
|
{
|
|
wmiNotAvailable = true;
|
|
}
|
|
catch (COMException)
|
|
{
|
|
wmiNotAvailable = true;
|
|
}
|
|
|
|
if (wmiNotAvailable)
|
|
{
|
|
Logger.Error?.Print(LogClass.Application, "WMI isn't available, system informations will use default values.");
|
|
|
|
CpuName = "Unknown";
|
|
}
|
|
}
|
|
}
|
|
} |