Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added external/LibreHardwareMonitor/Aga.Controls.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified external/LibreHardwareMonitor/HidSharp.dll
Binary file not shown.
Binary file modified external/LibreHardwareMonitor/LibreHardwareMonitorLib.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added external/LibreHardwareMonitor/OxyPlot.dll
Binary file not shown.
Binary file not shown.
Binary file added external/LibreHardwareMonitor/System.Buffers.dll
Binary file not shown.
Binary file added external/LibreHardwareMonitor/System.CodeDom.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added external/LibreHardwareMonitor/System.Memory.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
339 changes: 339 additions & 0 deletions external/PawnIO/LICENSE

Large diffs are not rendered by default.

Binary file added external/PawnIO/PawnIO_setup.exe
Binary file not shown.
31 changes: 17 additions & 14 deletions library/sensors/sensors_librehardwaremonitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,28 +381,31 @@ def is_available(cls) -> bool:
class Memory(sensors.Memory):
@staticmethod
def swap_percent() -> float:
memory = get_hw_and_update(Hardware.HardwareType.Memory)
ram = get_hw_and_update(Hardware.HardwareType.Memory, "Total Memory")
vram = get_hw_and_update(Hardware.HardwareType.Memory, "Virtual Memory")

virtual_mem_used = math.nan
mem_used = math.nan
virtual_mem_available = math.nan
mem_available = math.nan

# Get virtual / physical memory stats
for sensor in memory.Sensors:
for sensor in ram.Sensors:
if sensor.SensorType == Hardware.SensorType.Data and str(sensor.Name).startswith(
"Virtual Memory Used") and sensor.Value is not None:
virtual_mem_used = int(sensor.Value)
elif sensor.SensorType == Hardware.SensorType.Data and str(sensor.Name).startswith(
"Memory Used") and sensor.Value is not None:
mem_used = int(sensor.Value)
elif sensor.SensorType == Hardware.SensorType.Data and str(sensor.Name).startswith(
"Virtual Memory Available") and sensor.Value is not None:
virtual_mem_available = int(sensor.Value)
elif sensor.SensorType == Hardware.SensorType.Data and str(sensor.Name).startswith(
"Memory Available") and sensor.Value is not None:
mem_available = int(sensor.Value)

for sensor in vram.Sensors:
if sensor.SensorType == Hardware.SensorType.Data and str(sensor.Name).startswith(
"Memory Used") and sensor.Value is not None:
virtual_mem_used = int(sensor.Value)
elif sensor.SensorType == Hardware.SensorType.Data and str(sensor.Name).startswith(
"Memory Available") and sensor.Value is not None:
virtual_mem_available = int(sensor.Value)

# Compute swap stats from virtual / physical memory stats
swap_used = virtual_mem_used - mem_used
swap_available = virtual_mem_available - mem_available
Expand All @@ -417,8 +420,8 @@ def swap_percent() -> float:

@staticmethod
def virtual_percent() -> float:
memory = get_hw_and_update(Hardware.HardwareType.Memory)
for sensor in memory.Sensors:
ram = get_hw_and_update(Hardware.HardwareType.Memory, "Total Memory")
for sensor in ram.Sensors:
if sensor.SensorType == Hardware.SensorType.Load and str(sensor.Name).startswith(
"Memory") and sensor.Value is not None:
return float(sensor.Value)
Expand All @@ -427,8 +430,8 @@ def virtual_percent() -> float:

@staticmethod
def virtual_used() -> int: # In bytes
memory = get_hw_and_update(Hardware.HardwareType.Memory)
for sensor in memory.Sensors:
ram = get_hw_and_update(Hardware.HardwareType.Memory, "Total Memory")
for sensor in ram.Sensors:
if sensor.SensorType == Hardware.SensorType.Data and str(sensor.Name).startswith(
"Memory Used") and sensor.Value is not None:
return int(sensor.Value * 1000000000.0)
Expand All @@ -437,8 +440,8 @@ def virtual_used() -> int: # In bytes

@staticmethod
def virtual_free() -> int: # In bytes
memory = get_hw_and_update(Hardware.HardwareType.Memory)
for sensor in memory.Sensors:
ram = get_hw_and_update(Hardware.HardwareType.Memory, "Total Memory")
for sensor in ram.Sensors:
if sensor.SensorType == Hardware.SensorType.Data and str(sensor.Name).startswith(
"Memory Available") and sensor.Value is not None:
return int(sensor.Value * 1000000000.0)
Expand Down
100 changes: 100 additions & 0 deletions tools/windows-installer/turing-system-monitor.iss
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{group}\Turing System Monitor"; Filename: "{app}\configure.exe"

[Code]
(* Detect if the program is already installed or if it is the first installation *)
function IsUpgrade: Boolean;
var
Value: string;
Expand All @@ -98,8 +99,105 @@ begin
Result := (PageID = wpSelectComponents) and not IsUpgrade;
end;

(* Custom page to offer to install PawnIO driver *)
var
PagePawnIO: TWizardPage;
InstallPawnIOCheckBox: TNewCheckBox;
InfoText: TNewStaticText;
LinkLabel: TNewStaticText;

procedure CreatePagePawnIO;
begin
PagePawnIO := CreateCustomPage(
wpInstalling,
'Install PawnIO driver',
'Recommended for best experience'
);

InfoText := TNewStaticText.Create(PagePawnIO);
InfoText.Parent := PagePawnIO.Surface;
InfoText.Left := ScaleX(0);
InfoText.Top := ScaleY(10);
InfoText.Width := PagePawnIO.SurfaceWidth;
InfoText.Height := ScaleY(60);
InfoText.WordWrap := True;
InfoText.Caption :=
'PawnIO is an open-source scriptable universal kernel driver, allowing hardware access to a wide variety of programs.' + #13#10 +
'It is used by LibreHardwareMonitor as a replacement to the old WinRing0 driver that was vulnerable.' + #13#10 +
'If you do not install it, some hardware metrics such as clocks, temperatures, etc. will be limited or unavailable.' + #13#10 +
'More information: https://pawnio.eu/';

{ Création de la case à cocher }
InstallPawnIOCheckBox := TNewCheckBox.Create(PagePawnIO);
InstallPawnIOCheckBox.Parent := PagePawnIO.Surface;
InstallPawnIOCheckBox.Caption := 'Install / update PawnIO driver (admin. rights needed)';
InstallPawnIOCheckBox.Left := ScaleX(0);
InstallPawnIOCheckBox.Top := InfoText.Top + InfoText.Height + ScaleY(20);
InstallPawnIOCheckBox.Width := PagePawnIO.SurfaceWidth;
InstallPawnIOCheckBox.Font.Style := [fsBold];
InstallPawnIOCheckBox.Checked := True;
end;

function NextButtonClick(CurPageID: Integer): Boolean;
var
ResultCode: Integer;
begin
(* Do not remove !*)
Result := True;

if CurPageID = PagePawnIO.ID then
begin
if InstallPawnIOCheckBox.Checked then
begin
if not FileExists(ExpandConstant('{app}\external\PawnIO\PawnIO_setup.exe')) then
begin
MsgBox(ExpandConstant('{app}\external\PawnIO\PawnIO_setup.exe not found'), mbError, MB_OK);
end
else
begin
if not ShellExec(
'',
ExpandConstant('{app}\external\PawnIO\PawnIO_setup.exe'),
'-uninstall -silent',
ExpandConstant('{app}'),
SW_SHOWNORMAL,
ewWaitUntilTerminated,
ResultCode
) then
begin
MsgBox(
'Failed to run PawnIO_setup.exe.'#13#10 +
'Error code :' + IntToStr(ResultCode),
mbError,
MB_OK
);
end;

if not ShellExec(
'',
ExpandConstant('{app}\external\PawnIO\PawnIO_setup.exe'),
'-install -silent',
ExpandConstant('{app}'),
SW_SHOWNORMAL,
ewWaitUntilTerminated,
ResultCode
) then
begin
MsgBox(
'Failed to run PawnIO_setup.exe.'#13#10 +
'Error code :' + IntToStr(ResultCode),
mbError,
MB_OK
);
end;
end;
end;
end;
end;

procedure InitializeWizard;
begin
(* If update do not install themes and config by default to avoid overwriting user changes *)
if IsUpgrade then begin
Log('Upgrade detected');
WizardSelectComponents('program !themes, !config');
Expand All @@ -108,4 +206,6 @@ begin
Log('First installation');
WizardSelectComponents('program themes config');
end;

CreatePagePawnIO();
end;