From 9bf2447ab9f73626cd4628ae1d9243851cc9096b Mon Sep 17 00:00:00 2001
From: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com>
Date: Sat, 16 Oct 2021 10:34:05 +0200
Subject: [PATCH]
https://github.com/LibreHardwareMonitor/LibreHardwareMonitor/issues/566#issuecomment-944841060
---
.../LibreHardwareMonitor.csproj | 1 +
LibreHardwareMonitorLib/Hardware/RyzenSMU.cs | 18 +++++-------------
2 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/LibreHardwareMonitor/LibreHardwareMonitor.csproj b/LibreHardwareMonitor/LibreHardwareMonitor.csproj
index 4210438..66d4a22 100644
--- a/LibreHardwareMonitor/LibreHardwareMonitor.csproj
+++ b/LibreHardwareMonitor/LibreHardwareMonitor.csproj
@@ -12,6 +12,7 @@
true
..\bin\$(Configuration)\
latest
+ AnyCPU
full
diff --git a/LibreHardwareMonitorLib/Hardware/RyzenSMU.cs b/LibreHardwareMonitorLib/Hardware/RyzenSMU.cs
index 74ffd9a..e84f89f 100644
--- a/LibreHardwareMonitorLib/Hardware/RyzenSMU.cs
+++ b/LibreHardwareMonitorLib/Hardware/RyzenSMU.cs
@@ -86,12 +86,14 @@ namespace LibreHardwareMonitor.Hardware
{
_cpuCodeName = GetCpuCodeName(family, model, packageType);
- _supportedCPU = SetAddresses(_cpuCodeName);
+ _supportedCPU = Environment.Is64BitOperatingSystem == Environment.Is64BitProcess && SetAddresses(_cpuCodeName);
if (_supportedCPU)
+ {
InpOut.Open();
- SetupPmTableAddrAndSize();
+ SetupPmTableAddrAndSize();
+ }
}
private static CpuCodeName GetCpuCodeName(uint family, uint model, uint packageType)
@@ -274,13 +276,7 @@ namespace LibreHardwareMonitor.Hardware
public float[] GetPmTable()
{
- if (!_supportedCPU)
- return new float[] { 0 };
-
- if (!SetupPmTableAddrAndSize())
- return new float[] { 0 };
-
- if (!TransferTableToDram())
+ if (!_supportedCPU || !TransferTableToDram())
return new float[] { 0 };
@@ -301,10 +297,6 @@ namespace LibreHardwareMonitor.Hardware
{
float[] table = new float[_pmTableSize / 4];
- if (_dramBaseAddr > int.MaxValue)
- return table;
-
-
byte[] bytes = InpOut.ReadMemory(new IntPtr(_dramBaseAddr), _pmTableSize);
if (bytes != null)
Buffer.BlockCopy(bytes, 0, table, 0, bytes.Length);