aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXpl0itR <xpl0itr@outlook.com>2020-04-25 14:01:32 +0100
committerGitHub <noreply@github.com>2020-04-25 23:01:32 +1000
commita065dc1626d2fa4cb5c7300a1aa8713ffb4f5896 (patch)
tree7bca624924ef12d5a9b34aca1bd794775d3ae7fa
parentfe5bb439f18cfcce55b44bc45c9632ab6594b38f (diff)
Log Ryujinx Version, OS Name, CPU Name and RAM size (#1102)
* Log Ryujinx version and OS * Log total RAM size and CPU name * Requested changes * requested change * jd's requested changes * jd's requested changes
-rw-r--r--Ryujinx.Common/Ryujinx.Common.csproj1
-rw-r--r--Ryujinx.Common/SystemInfo.cs41
-rw-r--r--Ryujinx/Program.cs9
3 files changed, 50 insertions, 1 deletions
diff --git a/Ryujinx.Common/Ryujinx.Common.csproj b/Ryujinx.Common/Ryujinx.Common.csproj
index 26fb73c4..e902d26a 100644
--- a/Ryujinx.Common/Ryujinx.Common.csproj
+++ b/Ryujinx.Common/Ryujinx.Common.csproj
@@ -31,6 +31,7 @@
<NoWarn>NU1701</NoWarn>
</PackageReference>
<PackageReference Include="MsgPack.Cli" Version="1.0.1" />
+ <PackageReference Include="System.Management" Version="4.7.0" />
<PackageReference Include="Utf8Json" Version="1.3.7" />
</ItemGroup>
diff --git a/Ryujinx.Common/SystemInfo.cs b/Ryujinx.Common/SystemInfo.cs
new file mode 100644
index 00000000..dbe02617
--- /dev/null
+++ b/Ryujinx.Common/SystemInfo.cs
@@ -0,0 +1,41 @@
+using System;
+using System.IO;
+using System.Linq;
+using System.Management;
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.Common
+{
+ public static class SystemInfo
+ {
+ public static string OsDescription { get; private set; }
+ public static string CpuName { get; private set; }
+ public static string RamSize { get; private set; }
+
+ static SystemInfo()
+ {
+ OsDescription = $"{RuntimeInformation.OSDescription} ({RuntimeInformation.OSArchitecture})";
+ CpuName = "Unknown";
+ RamSize = "Unknown";
+
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ 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 = $"{Math.Round(double.Parse(mObject["TotalVisibleMemorySize"].ToString()) / 1024, 0)} MB";
+ }
+ }
+
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ {
+ CpuName = File.ReadAllLines("/proc/cpuinfo").Where(line => line.StartsWith("model name")).ToList()[0].Split(":")[1].Trim();
+ RamSize = $"{Math.Round(double.Parse(File.ReadAllLines("/proc/meminfo")[0].Split(":")[1].Trim().Split(" ")[0]) / 1024, 0)} MB";
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Ryujinx/Program.cs b/Ryujinx/Program.cs
index 2f02e003..2a906b82 100644
--- a/Ryujinx/Program.cs
+++ b/Ryujinx/Program.cs
@@ -1,4 +1,5 @@
using Gtk;
+using Ryujinx.Common;
using Ryujinx.Common.Logging;
using Ryujinx.Configuration;
using Ryujinx.Debugger.Profiler;
@@ -15,7 +16,7 @@ namespace Ryujinx
public static string Version { get; private set; }
public static string ConfigurationPath { get; set; }
-
+
static void Main(string[] args)
{
Toolkit.Init(new ToolkitOptions
@@ -42,6 +43,12 @@ namespace Ryujinx
// Initialize Discord integration
DiscordIntegrationModule.Initialize();
+ Logger.PrintInfo(LogClass.Application, $"Ryujinx Version: {Version}");
+
+ Logger.PrintInfo(LogClass.Application, $"Operating System: {SystemInfo.OsDescription}");
+ Logger.PrintInfo(LogClass.Application, $"CPU: {SystemInfo.CpuName}");
+ Logger.PrintInfo(LogClass.Application, $"Total RAM: {SystemInfo.RamSize}");
+
string localConfigurationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json");
string globalBasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Ryujinx");
string globalConfigurationPath = Path.Combine(globalBasePath, "Config.json");