mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-22 10:31:13 +02:00
Windows ARM (win-arm64) build now launches with full trimming
This commit is contained in:
@@ -50,7 +50,6 @@
|
||||
<PackageVersion Include="SkiaSharp.NativeAssets.Linux" Version="2.88.9" />
|
||||
<PackageVersion Include="SPB" Version="0.0.4-build32" />
|
||||
<PackageVersion Include="System.IO.Hashing" Version="10.0.3" />
|
||||
<PackageVersion Include="System.Management" Version="10.0.3" />
|
||||
<PackageVersion Include="UnicornEngine.Unicorn" Version="2.1.4-a40db6c" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -10,7 +10,6 @@
|
||||
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" />
|
||||
<PackageReference Include="MsgPack.Cli" />
|
||||
<PackageReference Include="Newtonsoft.Json" />
|
||||
<PackageReference Include="System.Management" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Ryujinx.Common.Logging;
|
||||
using System;
|
||||
using System.Management;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
@@ -11,7 +10,7 @@ namespace Ryujinx.UI.Common.SystemInfo
|
||||
{
|
||||
internal WindowsSystemInfo()
|
||||
{
|
||||
CpuName = $"{GetCpuidCpuName() ?? GetCpuNameWMI()} ; {LogicalCoreCount} logical"; // WMI is very slow
|
||||
CpuName = $"{GetCpuidCpuName() ?? GetCpuName()} ; {LogicalCoreCount} logical";
|
||||
(RamTotal, RamAvailable) = GetMemoryStats();
|
||||
}
|
||||
|
||||
@@ -28,25 +27,33 @@ namespace Ryujinx.UI.Common.SystemInfo
|
||||
return (0, 0);
|
||||
}
|
||||
|
||||
private static string GetCpuNameWMI()
|
||||
private static string GetCpuName()
|
||||
{
|
||||
ManagementObjectCollection cpuObjs = GetWMIObjects("root\\CIMV2", "SELECT * FROM Win32_Processor");
|
||||
string cpuName = GetCpuNameFromRegistry();
|
||||
|
||||
if (cpuObjs != null)
|
||||
return !string.IsNullOrEmpty(cpuName) ? cpuName : Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER")?.Trim();
|
||||
}
|
||||
|
||||
private static string GetCpuNameFromRegistry()
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var cpuObj in cpuObjs)
|
||||
{
|
||||
return cpuObj["Name"].ToString()?.Trim();
|
||||
}
|
||||
}
|
||||
using var key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(
|
||||
@"HARDWARE\DESCRIPTION\System\CentralProcessor\0");
|
||||
|
||||
return Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER")?.Trim();
|
||||
return key?.GetValue("ProcessorNameString")?.ToString()?.Trim();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error?.Print(LogClass.Application, $"Registry CPU name lookup failed: {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct MemoryStatusEx
|
||||
private struct MemoryStatusEx()
|
||||
{
|
||||
public uint Length;
|
||||
public uint Length = (uint)Marshal.SizeOf<MemoryStatusEx>();
|
||||
public uint MemoryLoad;
|
||||
public ulong TotalPhys;
|
||||
public ulong AvailPhys;
|
||||
@@ -55,33 +62,10 @@ namespace Ryujinx.UI.Common.SystemInfo
|
||||
public ulong TotalVirtual;
|
||||
public ulong AvailVirtual;
|
||||
public ulong AvailExtendedVirtual;
|
||||
|
||||
public MemoryStatusEx()
|
||||
{
|
||||
Length = (uint)Marshal.SizeOf<MemoryStatusEx>();
|
||||
}
|
||||
}
|
||||
|
||||
[LibraryImport("kernel32.dll", SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
private static partial bool GlobalMemoryStatusEx(ref MemoryStatusEx lpBuffer);
|
||||
|
||||
private static ManagementObjectCollection GetWMIObjects(string scope, string query)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new ManagementObjectSearcher(scope, query).Get();
|
||||
}
|
||||
catch (PlatformNotSupportedException ex)
|
||||
{
|
||||
Logger.Error?.Print(LogClass.Application, $"WMI isn't available : {ex.Message}");
|
||||
}
|
||||
catch (COMException ex)
|
||||
{
|
||||
Logger.Error?.Print(LogClass.Application, $"WMI isn't available : {ex.Message}");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,4 @@
|
||||
<type fullname="Ryujinx.HLE.HOS.Services*" preserve="all"/>
|
||||
</assembly>
|
||||
<assembly fullname="DiscordRPC" preserve="all"/>
|
||||
<assembly fullname="System.Management">
|
||||
<type fullname="System.Management.MTAHelper*" preserve="all"/>
|
||||
<type fullname="System.Management.WmiNetUtilsHelper*" preserve="all"/>
|
||||
</assembly>
|
||||
</linker>
|
||||
|
||||
Reference in New Issue
Block a user