Compare commits

..

102 Commits

Author SHA1 Message Date
Serge
02c2a7ff37 Power limits in Asus way 2024-03-03 00:41:31 +01:00
IceStormNG
65c5b645a8 Small bugfix: Do not allow to open the autotdp window more than once. 2024-03-02 20:06:21 +01:00
IceStormNG
61803dbc39 Renamed some controls 2024-03-02 17:30:36 +01:00
IceStormNG
adcec744d4 Do not use top most, but dialog for the game settings. 2024-03-02 17:30:18 +01:00
IceStormNG
12d7afc532 Stuttering has bigger impact on stability. 2024-03-02 17:21:02 +01:00
IceStormNG
cb685f9158 Fixes for stability checks 2024-03-02 17:00:11 +01:00
IceStormNG
6523d6ac12 Added more logging. 2024-03-02 16:41:22 +01:00
IceStormNG
b8c3c04e4b Lower default min power to 15W and remove the .exe from the default game title. 2024-03-02 16:41:05 +01:00
IceStormNG
0eb5394af8 Merge branch 'seerge:main' into cpu-auto-tdp 2024-03-02 13:56:57 +01:00
IceStormNG
b765514477 Check limiters for their availability before using them 2024-03-02 13:56:21 +01:00
IceStormNG
da47c094e4 Streamlined options and availability checks for limiters and fps sources 2024-03-02 13:55:25 +01:00
Serge
c32fa46991 Added 100ms delay before setting fan curves 2024-03-02 13:41:57 +01:00
IceStormNG
f2ef77b866 Better logic to handle availability of tdp limiters 2024-03-02 13:29:56 +01:00
IceStormNG
b104d852c7 Explicitly save previous power limits 2024-03-02 13:26:37 +01:00
IceStormNG
89de581e1f Also set FPPT boost for non all-amd models 2024-03-02 13:22:55 +01:00
IceStormNG
40d31c0de2 Merge branch 'seerge:main' into cpu-auto-tdp 2024-03-02 13:18:48 +01:00
IceStormNG
edf05935c0 Use constants instead of hardcoding the MSR index. 2024-03-02 13:18:31 +01:00
IceStormNG
082c7036f5 Check whether autotdp is available at all. 2024-03-02 13:16:08 +01:00
Serge
b94e20a3fc Power limits cleanup 2024-03-02 12:35:47 +01:00
Serge
2d0defd484 Power limits cleanup 2024-03-02 12:00:37 +01:00
IceStormNG
2e9a34d8f5 Adjusted some comments to reflect recent code changes 2024-03-02 11:35:40 +01:00
Serge
6f49af19ed Cleanup 2024-03-02 11:25:11 +01:00
Serge
097d91b5a4 Cleanup 2024-03-02 11:23:22 +01:00
IceStormNG
181a16bee3 Merge branch 'main' into cpu-auto-tdp
# Conflicts:
#	app/Settings.cs
2024-03-01 23:59:55 +01:00
IceStormNG
599def92b3 Merge branch 'seerge:main' into main 2024-03-01 23:53:39 +01:00
IceStormNG
c31e52bc74 PID already does that. Therefore it is not necessary 2024-03-01 23:53:07 +01:00
IceStormNG
5fee6e03d1 Logic to find a stable minimum TDP for improved stability and less frame dips in low demanding scenes. 2024-03-01 23:22:57 +01:00
Serge
f36a55f086 Reapply brightness on display config change 2024-03-01 23:19:44 +01:00
IceStormNG
7f087d36dc Ignore case when finding game profile by process name 2024-03-01 20:15:11 +01:00
IceStormNG
6850b644a0 Fix for detecting exit of game 2024-03-01 20:14:53 +01:00
Serge
c1a6019d57 Increased Fan calibration limit https://github.com/seerge/g-helper/issues/2145 2024-03-01 19:57:10 +01:00
IceStormNG
0370aa8c94 Fixed reset not working when a game was running 2024-03-01 18:57:20 +01:00
IceStormNG
f1198440d4 Better calibration for tdp adjustments to not cause extreme stutters 2024-03-01 18:56:55 +01:00
IceStormNG
8cd256463a Use watts as double to have more fine grained control 2024-03-01 18:55:50 +01:00
IceStormNG
2aebf3044d Fix for not detecting older games 2024-03-01 18:55:01 +01:00
IceStormNG
5d231ea172 Fix min slider affecting the max slider the wrong way 2024-03-01 18:54:40 +01:00
IceStormNG
b9b98577d0 ASUS power limiter fixes 2024-03-01 15:33:28 +01:00
IceStormNG
37dfa199b0 Merge branch 'seerge:main' into cpu-auto-tdp 2024-03-01 14:28:49 +01:00
IceStormNG
9b59e7b08c Merge branch 'seerge:main' into main 2024-03-01 14:28:35 +01:00
Serge
63b357a71b GPU Power slider limits 2024-03-01 12:38:48 +01:00
Serge
c337103806 Merge branch 'main' of https://github.com/seerge/g-helper 2024-03-01 12:32:43 +01:00
Serge
268e55d47a UI Tweaks 2024-03-01 12:32:41 +01:00
IceStormNG
20a04dd1b2 Merge branch 'seerge:main' into cpu-auto-tdp 2024-03-01 11:16:27 +01:00
Serge
3cc4955dd7 GPU Power limit slider for 2024 models (#2142)
* GPU TGP setting for supported models

* Version bump

* GPU Power tweaks

* GPU Power UI Tweaks

* Cleanup
2024-03-01 11:09:30 +01:00
IceStormNG
06205a1ad3 Make interface more flexible by passing the whole instance object to the framerate source 2024-03-01 07:52:27 +01:00
IceStormNG
82f90fcab3 Make sure the game list is initialzed 2024-03-01 07:50:13 +01:00
IceStormNG
4af2bf63c7 Remove unnecessary usings 2024-03-01 07:49:53 +01:00
IceStormNG
54dcb46527 Merge branch 'seerge:main' into cpu-auto-tdp 2024-03-01 07:47:19 +01:00
IceStormNG
20c9d57299 Merge branch 'seerge:main' into main 2024-03-01 07:47:09 +01:00
IceStormNG
84a6fd4d5f Added AutoTDP feature with RTSS source and Intel + ASUS power limiters 2024-03-01 07:47:00 +01:00
Serge
db8e4b9c5e New translations strings.resx (German) (#2139) 2024-02-29 10:00:42 +01:00
Serge
c517f340dc Merge branch 'main' of https://github.com/seerge/g-helper 2024-02-28 23:39:20 +01:00
Serge
f0da110a83 Config writing fix https://github.com/seerge/g-helper/issues/2133 2024-02-28 23:39:18 +01:00
IceStormNG
7cc4e87d5f Merge branch 'seerge:main' into main 2024-02-28 20:30:02 +01:00
Serge
88ab4f396e Update SECURITY.md 2024-02-27 15:41:41 +01:00
Serge
4378118951 Update README.md 2024-02-27 15:28:45 +01:00
Serge
df71595b45 New translations strings.resx (Spanish) (#2122) 2024-02-26 18:52:36 +01:00
IceStormNG
e7bb9c81d2 Support for Strix Impact (P303) (#2121)
* Support for Strix Carry (P508)

* Fixes polling rate, angle snapping and debounce for Gladius II Origin.

* The Gen2 version of the TuF M3 uses 0-100 for brightness.

* Adds support for ROG Strix Impact III (P518)

* Import/Export feature for mice.

* Suppor for Strix Impact (P303)
2024-02-26 15:09:08 +01:00
Serge
3b54e89d8e UI Tweaks 2024-02-26 15:08:52 +01:00
Serge
aa07a39c35 UI tweaks 2024-02-26 14:57:27 +01:00
Serge
48e65dea97 New Crowdin updates (#2120)
* New translations strings.resx (Romanian)

* New translations strings.resx (French)

* New translations strings.resx (Spanish)

* New translations strings.resx (German)

* New translations strings.resx (Hungarian)

* New translations strings.resx (Italian)

* New translations strings.resx (Korean)

* New translations strings.resx (Lithuanian)

* New translations strings.resx (Polish)

* New translations strings.resx (Portuguese)

* New translations strings.resx (Turkish)

* New translations strings.resx (Ukrainian)

* New translations strings.resx (Chinese Simplified)

* New translations strings.resx (Chinese Traditional)

* New translations strings.resx (Vietnamese)

* New translations strings.resx (Portuguese, Brazilian)

* New translations strings.resx (Indonesian)

* New translations strings.resx (Romanian)

* New translations strings.resx (French)

* New translations strings.resx (Spanish)

* New translations strings.resx (German)

* New translations strings.resx (Hungarian)

* New translations strings.resx (Italian)

* New translations strings.resx (Korean)

* New translations strings.resx (Lithuanian)

* New translations strings.resx (Polish)

* New translations strings.resx (Portuguese)

* New translations strings.resx (Turkish)

* New translations strings.resx (Ukrainian)

* New translations strings.resx (Chinese Simplified)

* New translations strings.resx (Chinese Traditional)

* New translations strings.resx (Vietnamese)

* New translations strings.resx (Portuguese, Brazilian)

* New translations strings.resx (Indonesian)
2024-02-26 14:53:45 +01:00
Serge
b3e4578c02 UI Tweaks 2024-02-26 14:40:13 +01:00
Serge
76f29c5934 UI Tweaks 2024-02-26 14:29:36 +01:00
Serge
c57a60079c Matrix / Slash Lightning - Disable on Lid Close 2024-02-26 12:30:43 +01:00
Serge
25470ed579 Touchpad and Mic Toggles 2024-02-26 10:33:18 +01:00
Serge
95b9a833c1 Tweaks 2024-02-25 21:10:58 +01:00
Serge
d156d8ace9 P-core tweaks 2024-02-25 20:01:16 +01:00
Serge
6d696c5c77 P-cores fix 2024-02-25 19:55:39 +01:00
Serge
b644402155 Better power mode logging 2024-02-25 13:44:57 +01:00
Serge
0e4422f103 Intel Cores UI tweaks 2024-02-25 13:22:07 +01:00
Serge
a9c6033c35 Intel E/P Cores UI Tweaks 2024-02-25 11:39:43 +01:00
Serge
4889f0277f Intel E/P Cores configuration 2024-02-25 11:24:02 +01:00
Serge
267662e15b Extended OLED models list 2024-02-24 18:56:32 +01:00
Serge
34d2273ff5 LidClosed mode for Slash Lightning 2024-02-24 12:02:43 +01:00
Serge
61cc54b709 Update README.md 2024-02-24 11:47:43 +01:00
Serge
4ee93775f5 Version bump 2024-02-24 11:44:35 +01:00
Serge
285cd81509 Flicker-free dimming slider for OLED models (#2109)
* Gamma Init

* Cleanup

* Show flicker-free dimming only on supported models

* Gamma ramp tweaks

* Gamma improvements

* Stronger dimming

* Added OLED model detection
2024-02-24 11:41:41 +01:00
Serge
034b46e557 Update README.md 2024-02-24 09:48:59 +01:00
Serge
4697c37cad Ultimate mode tweaks 2024-02-24 09:48:24 +01:00
Serge
2a4e1f41f6 Merge branch 'main' of https://github.com/seerge/g-helper 2024-02-21 17:30:02 +01:00
Serge
4196ccf33f Minor tweaks 2024-02-21 17:29:52 +01:00
Serge
c24dac2e4f Update README.md 2024-02-20 19:06:14 +01:00
Serge
555a6f4ed7 New translations strings.resx (French) (#2085) 2024-02-19 20:00:15 +01:00
Serge
f10dee4e47 New translations strings.resx (French) (#2080) 2024-02-18 19:21:24 +01:00
Serge
c82bc874cf Double WMI and hotkey fix for ancient models https://github.com/seerge/g-helper/issues/2081 2024-02-18 19:19:55 +01:00
Serge
a6a453704a Merge branch 'main' of https://github.com/seerge/g-helper 2024-02-17 18:29:34 +01:00
Serge
c33edac4b4 Better error handling for missing display name https://github.com/seerge/g-helper/issues/2077 2024-02-17 18:29:32 +01:00
Serge
16e30598e9 New translations strings.resx (French) (#2076) 2024-02-17 18:17:32 +01:00
Serge
970de2adef New Crowdin updates (#2075)
* New translations strings.resx (French)

* New translations strings.resx (Chinese Traditional)
2024-02-17 16:10:24 +01:00
Serge
293b261b37 Update README.md 2024-02-17 11:34:04 +01:00
IceStormNG
dea90f66b2 Merge branch 'seerge:main' into main 2024-02-16 14:58:04 +01:00
IceStormNG
ac9b67868e Merge branch 'seerge:main' into main 2024-02-10 19:37:40 +01:00
IceStormNG
e08092a754 Merge branch 'seerge:main' into main 2024-02-10 16:36:19 +01:00
IceStormNG
7e3d6eab44 Merge branch 'seerge:main' into main 2024-02-08 15:26:07 +01:00
IceStormNG
cf447174cb Merge branch 'seerge:main' into main 2024-02-05 14:14:56 +01:00
IceStormNG
0d18e5b850 Merge branch 'seerge:main' into main 2024-02-04 14:34:26 +01:00
IceStormNG
df52fbe25d Merge branch 'seerge:main' into main 2024-02-01 19:38:54 +01:00
IceStormNG
0a86b6db3c Merge branch 'seerge:main' into main 2024-01-31 11:48:39 +01:00
IceStormNG
acf52c2edd Application.Exit might not exit if there is a child process running. Environment.Exit(0) do though. 2024-01-13 11:27:04 +01:00
IceStormNG
b006a11dcf Wait for process to terminate instead of waiting a fixed amount of time. 2024-01-13 11:26:23 +01:00
IceStormNG
0dc16c5cda Merge branch 'seerge:main' into main 2024-01-13 11:21:13 +01:00
IceStormNG
b0e412f370 Automatically restart audio capture when device changes. 2024-01-12 18:16:06 +01:00
62 changed files with 3344 additions and 237 deletions

4
.github/SECURITY.md vendored
View File

@@ -4,8 +4,8 @@
| Version | Supported |
| ------- | ------------------ |
| 0.89+ | :white_check_mark: |
| < 0.89 | :x: |
| 0.151+ | :white_check_mark: |
| < 0.151 | :x: |
## Reporting a Vulnerability

View File

@@ -18,6 +18,8 @@ namespace GHelper.AnimeMatrix
public AnimeMatrixDevice? deviceMatrix;
public SlashDevice? deviceSlash;
public static bool lidClose = false;
double[]? AudioValues;
WasapiCapture? AudioDevice;
string? AudioDeviceId;
@@ -56,6 +58,15 @@ namespace GHelper.AnimeMatrix
if (deviceSlash is not null) SetSlash(wakeUp);
}
public void SetLidMode(bool force = false)
{
if (AppConfig.Is("matrix_lid") || force)
{
Logger.WriteLine($"Matrix LidClosed: {lidClose}");
SetDevice(true);
}
}
public void SetSlash(bool wakeUp = false)
{
@@ -66,6 +77,7 @@ namespace GHelper.AnimeMatrix
int inteval = AppConfig.Get("matrix_interval", 0);
bool auto = AppConfig.Is("matrix_auto");
bool lid = AppConfig.Is("matrix_lid");
Task.Run(() =>
{
@@ -81,7 +93,7 @@ namespace GHelper.AnimeMatrix
if (wakeUp) deviceSlash.WakeUp();
if (brightness == 0 || (auto && SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online))
if (brightness == 0 || (auto && SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online) || (lid && lidClose))
{
deviceSlash.Init();
deviceSlash.SetOptions(false, 0, 0);
@@ -110,6 +122,7 @@ namespace GHelper.AnimeMatrix
int brightness = AppConfig.Get("matrix_brightness", 0);
int running = AppConfig.Get("matrix_running", 0);
bool auto = AppConfig.Is("matrix_auto");
bool lid = AppConfig.Is("matrix_lid");
StopMatrixTimer();
StopMatrixAudio();
@@ -128,7 +141,7 @@ namespace GHelper.AnimeMatrix
if (wakeUp) deviceMatrix.WakeUp();
if (brightness == 0 || (auto && SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online))
if (brightness == 0 || (auto && SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online) || (lid && lidClose))
{
deviceMatrix.SetDisplayState(false);
deviceMatrix.SetDisplayState(false); // some devices are dumb

View File

@@ -127,6 +127,11 @@ namespace GHelper.AnimeMatrix
Set(Packet<SlashPacket>(0xD8, 0x01, 0x00, 0x01, status ? (byte)0x80 : (byte)0x00));
}
public void SetLidMode(bool status)
{
Set(Packet<SlashPacket>(0xD8, 0x00, 0x00, 0x02, 0xA5, status ? (byte)0x80 : (byte)0x00));
}
public void Set(Packet packet)
{
_usbProvider?.Set(packet.Data);

View File

@@ -67,9 +67,17 @@ public static class AppConfig
{
File.WriteAllText(backup, jsonString);
}
catch (Exception ex)
catch (Exception)
{
Logger.WriteLine(ex.ToString());
Thread.Sleep(100);
try
{
File.WriteAllText(backup, jsonString);
}
catch (Exception ex)
{
Logger.WriteLine(ex.Message);
}
return;
}
@@ -91,13 +99,19 @@ public static class AppConfig
if (_model is null)
{
_model = "";
using (var searcher = new ManagementObjectSearcher(@"Select * from Win32_ComputerSystem"))
try
{
foreach (var process in searcher.Get())
using (var searcher = new ManagementObjectSearcher(@"Select * from Win32_ComputerSystem"))
{
_model = process["Model"].ToString();
break;
foreach (var process in searcher.Get())
{
_model = process["Model"].ToString();
break;
}
}
} catch (Exception ex)
{
Logger.WriteLine(ex.Message);
}
}
@@ -391,7 +405,7 @@ public static class AppConfig
public static bool IsOLED()
{
return ContainsModel("OLED") || IsSlash() || ContainsModel("UX64") || ContainsModel("UX34") || ContainsModel("K360") || ContainsModel("X150");
return ContainsModel("OLED") || IsSlash() || ContainsModel("UX64") || ContainsModel("UX34") || ContainsModel("UX53") || ContainsModel("K360") || ContainsModel("X150");
}
public static bool IsStrix()
@@ -404,11 +418,17 @@ public static class AppConfig
return (ContainsModel("G614JV") || ContainsModel("G614JZ") || ContainsModel("G512LI") || ContainsModel("G513R") || ContainsModel("G713PV") || ContainsModel("G513IE") || ContainsModel("G713RC") || ContainsModel("G513QM") || ContainsModel("G531G")) && !Is("per_key_rgb");
}
public static bool IsNoAirplaneMode()
{
return ContainsModel("FX506");
}
public static bool NoWMI()
{
return ContainsModel("GL704G");
}
public static bool IsNoDirectRGB()
{
return ContainsModel("GA503") || ContainsModel("G533Q");
@@ -456,7 +476,7 @@ public static class AppConfig
public static bool NoAutoUltimate()
{
return ContainsModel("G614") || ContainsModel("GU604") || ContainsModel("FX507") || ContainsModel("G513") || ContainsModel("FA617") || ContainsModel("G834");
return ContainsModel("G614") || ContainsModel("GU604") || ContainsModel("FX507") || ContainsModel("G513") || ContainsModel("FA617") || ContainsModel("G834") || ContainsModel("GA403") || ContainsModel("GU605");
}

View File

@@ -43,6 +43,10 @@ public class AsusACPI
public const int Brightness_Down = 0x10;
public const int Brightness_Up = 0x20;
public const int KB_Sleep = 0x6c;
public const int KB_TouchpadToggle = 0x6b;
public const int KB_MuteToggle = 0x7c;
public const int KB_DUO_PgUpDn = 0x4B;
public const int KB_DUO_SecondDisplay = 0x6A;
@@ -98,6 +102,12 @@ public class AsusACPI
public const int PPT_APUC1 = 0x001200C1; // fPPT (fast boost limit)
public const int PPT_GPUC2 = 0x001200C2; // NVIDIA GPU Temp Target (75.. 87 C)
public const uint CORES_CPU = 0x001200D2; // Intel E-core and P-core configuration in a format 0x0[E]0[P]
public const uint CORES_MAX = 0x001200D3; // Maximum Intel E-core and P-core availability
public const uint GPU_BASE = 0x00120099; // Base part GPU TGP
public const uint GPU_POWER = 0x00120098; // Additonal part of GPU TGP
public const int APU_MEM = 0x000600C1;
public const int TUF_KB_BRIGHTNESS = 0x00050021;
@@ -143,9 +153,18 @@ public class AsusACPI
public const int MinGPUBoost = 5;
public static int MaxGPUBoost = 25;
public static int MinGPUPower = 0;
public static int MaxGPUPower = 50;
public const int MinGPUTemp = 75;
public const int MaxGPUTemp = 87;
public const int PCoreMin = 4;
public const int ECoreMin = 0;
public const int PCoreMax = 16;
public const int ECoreMax = 16;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
private static extern IntPtr CreateFile(
@@ -272,6 +291,12 @@ public class AsusACPI
if (AppConfig.IsIntelHX())
{
MaxTotal = 175;
MaxGPUPower = 70;
}
if (AppConfig.IsSlash())
{
MaxGPUPower = 25;
}
if (AppConfig.DynamicBoost5())
@@ -529,7 +554,7 @@ public class AsusACPI
break;
}
Logger.WriteLine($"GetFan {device} :" + BitConverter.ToString(result));
//Logger.WriteLine($"GetFan {device} :" + BitConverter.ToString(result));
return result;
@@ -674,6 +699,29 @@ public class AsusACPI
}
}
public (int, int) GetCores(bool max = false)
{
int value = Program.acpi.DeviceGet(max ? CORES_MAX : CORES_CPU);
//value = max ? 0x406 : 0x605;
if (value < 0) return (-1, -1);
Logger.WriteLine("Cores" + (max ? "Max" : "") + ": 0x" + value.ToString("X4"));
return ((value >> 8) & 0xFF, (value) & 0xFF);
}
public void SetCores(int eCores, int pCores)
{
if (eCores < ECoreMin || eCores > ECoreMax || pCores < PCoreMin || pCores > PCoreMax)
{
Logger.WriteLine($"Incorrect Core config ({eCores}, {pCores})");
return;
};
int value = (eCores << 8) | pCores;
Program.acpi.DeviceSet(CORES_CPU, value, "Cores (0x" + value.ToString("X4") + ")");
}
public string ScanRange()
{
int value;

View File

@@ -0,0 +1,336 @@
namespace GHelper.AutoTDP
{
partial class AutoTDPGameProfileUI
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
panelPerformanceHeader = new Panel();
pictureKeyboard = new PictureBox();
labelSettings = new Label();
checkBoxEnabled = new CheckBox();
panelGameSettings = new Panel();
labelMinTDP = new Label();
labelMaxTDP = new Label();
sliderMaxTDP = new UI.Slider();
numericUpDownFPS = new NumericUpDown();
sliderMinTDP = new UI.Slider();
labelMaxTDPText = new Label();
labeMinTDPText = new Label();
labelTargetFPS = new Label();
textBoxTitle = new TextBox();
textBoxProcessName = new TextBox();
labelFPSSource = new Label();
labelLimiter = new Label();
buttonSave = new UI.RButton();
buttonDelete = new UI.RButton();
panelPerformanceHeader.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureKeyboard).BeginInit();
panelGameSettings.SuspendLayout();
((System.ComponentModel.ISupportInitialize)numericUpDownFPS).BeginInit();
SuspendLayout();
//
// panelPerformanceHeader
//
panelPerformanceHeader.BackColor = SystemColors.ControlLight;
panelPerformanceHeader.Controls.Add(pictureKeyboard);
panelPerformanceHeader.Controls.Add(labelSettings);
panelPerformanceHeader.Controls.Add(checkBoxEnabled);
panelPerformanceHeader.Dock = DockStyle.Top;
panelPerformanceHeader.Location = new Point(0, 0);
panelPerformanceHeader.Name = "panelPerformanceHeader";
panelPerformanceHeader.Size = new Size(551, 50);
panelPerformanceHeader.TabIndex = 53;
//
// pictureKeyboard
//
pictureKeyboard.BackgroundImage = Properties.Resources.icons8_automation_32;
pictureKeyboard.BackgroundImageLayout = ImageLayout.Zoom;
pictureKeyboard.Location = new Point(4, 13);
pictureKeyboard.Name = "pictureKeyboard";
pictureKeyboard.Size = new Size(23, 27);
pictureKeyboard.TabIndex = 35;
pictureKeyboard.TabStop = false;
//
// labelSettings
//
labelSettings.AutoSize = true;
labelSettings.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelSettings.Location = new Point(31, 13);
labelSettings.Margin = new Padding(6, 0, 6, 0);
labelSettings.Name = "labelSettings";
labelSettings.Size = new Size(135, 25);
labelSettings.TabIndex = 34;
labelSettings.Text = "Game Settings";
//
// checkBoxEnabled
//
checkBoxEnabled.Location = new Point(344, 3);
checkBoxEnabled.Margin = new Padding(6, 0, 6, 0);
checkBoxEnabled.Name = "checkBoxEnabled";
checkBoxEnabled.Size = new Size(194, 42);
checkBoxEnabled.TabIndex = 53;
checkBoxEnabled.Text = "Enabled";
checkBoxEnabled.UseVisualStyleBackColor = true;
//
// panelGameSettings
//
panelGameSettings.AutoSize = true;
panelGameSettings.Controls.Add(labelMinTDP);
panelGameSettings.Controls.Add(labelMaxTDP);
panelGameSettings.Controls.Add(sliderMaxTDP);
panelGameSettings.Controls.Add(numericUpDownFPS);
panelGameSettings.Controls.Add(sliderMinTDP);
panelGameSettings.Controls.Add(labelMaxTDPText);
panelGameSettings.Controls.Add(labeMinTDPText);
panelGameSettings.Controls.Add(labelTargetFPS);
panelGameSettings.Controls.Add(textBoxTitle);
panelGameSettings.Controls.Add(textBoxProcessName);
panelGameSettings.Controls.Add(labelFPSSource);
panelGameSettings.Controls.Add(labelLimiter);
panelGameSettings.Dock = DockStyle.Top;
panelGameSettings.Location = new Point(0, 50);
panelGameSettings.Name = "panelGameSettings";
panelGameSettings.Padding = new Padding(0, 0, 0, 12);
panelGameSettings.Size = new Size(551, 244);
panelGameSettings.TabIndex = 57;
//
// labelMinTDP
//
labelMinTDP.Location = new Point(489, 152);
labelMinTDP.Margin = new Padding(4, 0, 4, 0);
labelMinTDP.Name = "labelMinTDP";
labelMinTDP.Size = new Size(56, 37);
labelMinTDP.TabIndex = 67;
labelMinTDP.Text = "30W";
labelMinTDP.TextAlign = ContentAlignment.MiddleRight;
//
// labelMaxTDP
//
labelMaxTDP.Location = new Point(487, 195);
labelMaxTDP.Margin = new Padding(4, 0, 4, 0);
labelMaxTDP.Name = "labelMaxTDP";
labelMaxTDP.Size = new Size(57, 37);
labelMaxTDP.TabIndex = 66;
labelMaxTDP.Text = "150W";
labelMaxTDP.TextAlign = ContentAlignment.MiddleRight;
//
// sliderMaxTDP
//
sliderMaxTDP.AccessibleName = "DPI Slider";
sliderMaxTDP.Location = new Point(200, 195);
sliderMaxTDP.Max = 200;
sliderMaxTDP.Min = 5;
sliderMaxTDP.Name = "sliderMaxTDP";
sliderMaxTDP.Size = new Size(291, 33);
sliderMaxTDP.Step = 1;
sliderMaxTDP.TabIndex = 65;
sliderMaxTDP.TabStop = false;
sliderMaxTDP.Text = "sliderBattery";
sliderMaxTDP.Value = 0;
//
// numericUpDownFPS
//
numericUpDownFPS.BorderStyle = BorderStyle.None;
numericUpDownFPS.Location = new Point(416, 110);
numericUpDownFPS.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
numericUpDownFPS.Minimum = new decimal(new int[] { 20, 0, 0, 0 });
numericUpDownFPS.Name = "numericUpDownFPS";
numericUpDownFPS.Size = new Size(123, 27);
numericUpDownFPS.TabIndex = 64;
numericUpDownFPS.TextAlign = HorizontalAlignment.Center;
numericUpDownFPS.Value = new decimal(new int[] { 60, 0, 0, 0 });
//
// sliderMinTDP
//
sliderMinTDP.AccessibleName = "DPI Slider";
sliderMinTDP.Location = new Point(200, 155);
sliderMinTDP.Max = 200;
sliderMinTDP.Min = 5;
sliderMinTDP.Name = "sliderMinTDP";
sliderMinTDP.Size = new Size(291, 33);
sliderMinTDP.Step = 1;
sliderMinTDP.TabIndex = 63;
sliderMinTDP.TabStop = false;
sliderMinTDP.Text = "sliderBattery";
sliderMinTDP.Value = 0;
//
// labelMaxTDPText
//
labelMaxTDPText.Location = new Point(7, 195);
labelMaxTDPText.Margin = new Padding(6, 0, 6, 0);
labelMaxTDPText.Name = "labelMaxTDPText";
labelMaxTDPText.Size = new Size(184, 37);
labelMaxTDPText.TabIndex = 61;
labelMaxTDPText.Text = "Max TDP:";
labelMaxTDPText.TextAlign = ContentAlignment.MiddleLeft;
//
// labeMinTDPText
//
labeMinTDPText.Location = new Point(7, 152);
labeMinTDPText.Margin = new Padding(6, 0, 6, 0);
labeMinTDPText.Name = "labeMinTDPText";
labeMinTDPText.Size = new Size(184, 37);
labeMinTDPText.TabIndex = 62;
labeMinTDPText.Text = "Min TDP:";
labeMinTDPText.TextAlign = ContentAlignment.MiddleLeft;
//
// labelTargetFPS
//
labelTargetFPS.Location = new Point(7, 105);
labelTargetFPS.Margin = new Padding(6, 0, 6, 0);
labelTargetFPS.Name = "labelTargetFPS";
labelTargetFPS.Size = new Size(184, 37);
labelTargetFPS.TabIndex = 60;
labelTargetFPS.Text = "Target FPS:";
labelTargetFPS.TextAlign = ContentAlignment.MiddleLeft;
//
// textBoxTitle
//
textBoxTitle.Location = new Point(200, 60);
textBoxTitle.Margin = new Padding(4, 5, 4, 5);
textBoxTitle.Name = "textBoxTitle";
textBoxTitle.Size = new Size(337, 31);
textBoxTitle.TabIndex = 59;
//
// textBoxProcessName
//
textBoxProcessName.Location = new Point(200, 10);
textBoxProcessName.Margin = new Padding(4, 5, 4, 5);
textBoxProcessName.Name = "textBoxProcessName";
textBoxProcessName.ReadOnly = true;
textBoxProcessName.Size = new Size(337, 31);
textBoxProcessName.TabIndex = 58;
textBoxProcessName.WordWrap = false;
//
// labelFPSSource
//
labelFPSSource.Location = new Point(6, 62);
labelFPSSource.Margin = new Padding(6, 0, 6, 0);
labelFPSSource.Name = "labelFPSSource";
labelFPSSource.Size = new Size(184, 37);
labelFPSSource.TabIndex = 57;
labelFPSSource.Text = "Name:";
labelFPSSource.TextAlign = ContentAlignment.MiddleLeft;
//
// labelLimiter
//
labelLimiter.Location = new Point(6, 12);
labelLimiter.Margin = new Padding(6, 0, 6, 0);
labelLimiter.Name = "labelLimiter";
labelLimiter.Size = new Size(184, 37);
labelLimiter.TabIndex = 47;
labelLimiter.Text = "Process";
labelLimiter.TextAlign = ContentAlignment.MiddleLeft;
//
// buttonSave
//
buttonSave.AccessibleName = "Keyboard Color";
buttonSave.Activated = false;
buttonSave.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonSave.BackColor = SystemColors.ButtonHighlight;
buttonSave.BorderColor = Color.Transparent;
buttonSave.BorderRadius = 2;
buttonSave.FlatStyle = FlatStyle.Flat;
buttonSave.ForeColor = SystemColors.ControlText;
buttonSave.Location = new Point(399, 303);
buttonSave.Margin = new Padding(3, 7, 3, 7);
buttonSave.Name = "buttonSave";
buttonSave.Secondary = false;
buttonSave.Size = new Size(147, 42);
buttonSave.TabIndex = 61;
buttonSave.Text = "Save";
buttonSave.UseVisualStyleBackColor = false;
//
// buttonDelete
//
buttonDelete.AccessibleName = "Keyboard Color";
buttonDelete.Activated = false;
buttonDelete.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonDelete.BackColor = SystemColors.ButtonHighlight;
buttonDelete.BorderColor = Color.Transparent;
buttonDelete.BorderRadius = 2;
buttonDelete.FlatStyle = FlatStyle.Flat;
buttonDelete.ForeColor = SystemColors.ControlText;
buttonDelete.Location = new Point(6, 303);
buttonDelete.Margin = new Padding(3, 7, 3, 7);
buttonDelete.Name = "buttonDelete";
buttonDelete.Secondary = false;
buttonDelete.Size = new Size(147, 42);
buttonDelete.TabIndex = 62;
buttonDelete.Text = "Delete";
buttonDelete.UseVisualStyleBackColor = false;
//
// AutoTDPGameProfileUI
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(551, 362);
Controls.Add(buttonDelete);
Controls.Add(buttonSave);
Controls.Add(panelGameSettings);
Controls.Add(panelPerformanceHeader);
FormBorderStyle = FormBorderStyle.FixedSingle;
Margin = new Padding(4, 5, 4, 5);
MaximizeBox = false;
MinimizeBox = false;
Name = "AutoTDPGameProfileUI";
ShowIcon = false;
ShowInTaskbar = false;
Text = "Game Profile";
panelPerformanceHeader.ResumeLayout(false);
panelPerformanceHeader.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureKeyboard).EndInit();
panelGameSettings.ResumeLayout(false);
panelGameSettings.PerformLayout();
((System.ComponentModel.ISupportInitialize)numericUpDownFPS).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Panel panelPerformanceHeader;
private PictureBox pictureKeyboard;
private Label labelSettings;
private CheckBox checkBoxEnabled;
private Panel panelGameSettings;
private Label labelFPSSource;
private Label labelLimiter;
private TextBox textBoxTitle;
private TextBox textBoxProcessName;
private UI.RButton buttonSave;
private Label labelMaxTDPText;
private Label labeMinTDPText;
private Label labelTargetFPS;
private UI.Slider sliderMinTDP;
private UI.Slider sliderMaxTDP;
private NumericUpDown numericUpDownFPS;
private Label labelMinTDP;
private Label labelMaxTDP;
private UI.RButton buttonDelete;
}
}

View File

@@ -0,0 +1,90 @@
using GHelper.UI;
namespace GHelper.AutoTDP
{
public partial class AutoTDPGameProfileUI : RForm
{
public GameProfile GameProfile;
private AutoTDPUI AutoTDPUI;
public AutoTDPGameProfileUI(GameProfile profile, AutoTDPUI parent)
{
AutoTDPUI = parent;
GameProfile = profile;
InitializeComponent();
sliderMinTDP.ValueChanged += SliderMinTDP_ValueChanged;
sliderMaxTDP.ValueChanged += SliderMaxTDP_ValueChanged;
buttonSave.Click += ButtonSave_Click;
buttonDelete.Click += ButtonDelete_Click;
InitTheme();
Shown += AutoTDPGameProfileUI_Shown;
VisualizeGameProfile();
}
private void ButtonDelete_Click(object? sender, EventArgs e)
{
AutoTDPUI.DeleteGameProfile(GameProfile);
Close();
}
private void ButtonSave_Click(object? sender, EventArgs e)
{
GameProfile.Enabled = checkBoxEnabled.Checked;
GameProfile.GameTitle = textBoxTitle.Text;
GameProfile.TargetFPS = ((int)numericUpDownFPS.Value);
GameProfile.MinTdp = sliderMinTDP.Value;
GameProfile.MaxTdp = sliderMaxTDP.Value;
AutoTDPUI.UpdateGameProfile(GameProfile);
Close();
}
private void SliderMaxTDP_ValueChanged(object? sender, EventArgs e)
{
labelMaxTDP.Text = sliderMaxTDP.Value + "W";
if (sliderMaxTDP.Value < sliderMinTDP.Value)
{
sliderMinTDP.Value = sliderMaxTDP.Value;
}
}
private void SliderMinTDP_ValueChanged(object? sender, EventArgs e)
{
labelMinTDP.Text = sliderMinTDP.Value + "W";
if (sliderMaxTDP.Value < sliderMinTDP.Value)
{
sliderMaxTDP.Value = sliderMinTDP.Value;
}
}
private void AutoTDPGameProfileUI_Shown(object? sender, EventArgs e)
{
if (Height > Program.settingsForm.Height)
{
Top = Program.settingsForm.Top + Program.settingsForm.Height - Height;
}
else
{
Top = Program.settingsForm.Top + 60;
}
Left = Program.settingsForm.Left - Width - ((AutoTDPUI.Width - Width) / 2);
}
private void VisualizeGameProfile()
{
sliderMinTDP.Value = GameProfile.MinTdp;
sliderMaxTDP.Value = GameProfile.MaxTdp;
numericUpDownFPS.Value = GameProfile.TargetFPS;
textBoxProcessName.Text = GameProfile.ProcessName;
textBoxTitle.Text = GameProfile.GameTitle;
checkBoxEnabled.Checked = GameProfile.Enabled;
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,620 @@
using System.Collections.Generic;
using System.Text.Json;
using GHelper.AutoTDP.FramerateSource;
using GHelper.AutoTDP.PowerLimiter;
using Ryzen;
namespace GHelper.AutoTDP
{
internal class AutoTDPService : IDisposable
{
private static readonly bool LOG_AUTO_TDP = false;
private static readonly int INTERVAL_MIN_CHECK = 30 * 1_000;
private static readonly int INTERVAL_APP_CHECK = 5_000;
private static readonly int INTERVAL_FPS_CHECK = 500;
string GameProfileFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper\\AutoTDP.json";
IFramerateSource? framerateSouce;
IPowerLimiter? powerLimiter;
public List<GameProfile> GameProfiles = new List<GameProfile>();
private bool Running = false;
private Thread? checkerThread;
private Thread? tdpThread;
private double GameFPSPrevious = double.NaN;
private double GameFPS;
private int FramerateTargetReachedCounter;
private int FramerateDipCounter;
private static readonly int FPSDipHistorySize = 6;
private List<double> FramerateLog = new List<double>();
private double LowestTDP;
private double LowestStableTDP;
private long LowestStableStability = 0;
private int LowestStableChecks = 0;
private double CurrentTDP;
private double LastAdjustment;
private double LastAdjustmentTotal = 0;
private int LastAdjustmentsWithoutImprovement = 0;
private GameInstance? currentGame;
public AutoTDPService()
{
LoadGameProfiles();
Start();
}
/// <summary>
/// Whether the system is enabled and currently running.
/// </summary>
/// <returns></returns>
public bool IsRunning()
{
return Running;
}
/// <summary>
/// Whether a supported game is actively monitored and TDP is adjusted
/// </summary>
/// <returns></returns>
public bool IsActive()
{
return currentGame is not null;
}
public static bool IsAvailable()
{
if (AppConfig.IsAlly())
{
//Not yet supported
return false;
}
return AvailablePowerLimiters().Count > 0 && AvailableFramerateSources().Count > 0;
}
public static List<string> AvailableFramerateSources()
{
List<string> l = new List<string>();
if (RTSSFramerateSource.IsAvailable()) l.Add("rtss");
Logger.WriteLine("[AutoTDPService] Available Framerate Sources: " + string.Join(", ", l.ToArray()));
return l;
}
public static List<string> AvailablePowerLimiters()
{
List<string> l = new List<string>();
if (IntelMSRPowerLimiter.IsAvailable()) l.Add("intel_msr");
if (ASUSACPIPowerLimiter.IsAvailable()) l.Add("asus_acpi");
Logger.WriteLine("[AutoTDPService] Available Power Limiters: " + string.Join(", ", l.ToArray()));
return l;
}
public void Start()
{
if (!IsEnabled() || IsRunning() || !IsAvailable())
{
Logger.WriteLine("[AutoTDPService] Refusing startup. Stats: Enabled: " + IsEnabled() + ", Running: " + IsRunning() + " ,Available: " + IsAvailable());
return;
}
Running = true;
InitFramerateSource();
InitLimiter();
checkerThread = new Thread(() =>
{
while (Running)
{
CheckForGame();
try
{
Thread.Sleep(INTERVAL_APP_CHECK);
}
catch (ThreadInterruptedException)
{
continue;
}
}
});
checkerThread.Start();
}
public bool IsEnabled()
{
return AppConfig.Get("auto_tdp_enabled", 0) == 1;
}
public void InitFramerateSource()
{
string? source = AppConfig.GetString("auto_tdp_fps_source");
if ((source is null || source.Equals("rtss")) && RTSSFramerateSource.IsAvailable())
{
Logger.WriteLine("[AutoTDPService] Initializing RTSSFramerateSource...");
RTSSFramerateSource rtss = new RTSSFramerateSource();
RTSSFramerateSource.Start();
framerateSouce = rtss;
return;
}
}
public void InitLimiter()
{
string? limiter = AppConfig.GetString("auto_tdp_limiter");
if (limiter is null || limiter.Equals("asus_acpi") && ASUSACPIPowerLimiter.IsAvailable())
{
Logger.WriteLine("[AutoTDPService] Initializing ASUSACPIPowerLimiter...");
powerLimiter = new ASUSACPIPowerLimiter();
return;
}
if (limiter is not null && limiter.Equals("intel_msr") && IntelMSRPowerLimiter.IsAvailable())
{
Logger.WriteLine("[AutoTDPService] Initializing IntelMSRPowerLimiter...");
powerLimiter = new IntelMSRPowerLimiter();
return;
}
}
public void SaveGameProfiles()
{
string json = JsonSerializer.Serialize(GameProfiles);
File.WriteAllText(GameProfileFile, json);
}
public void LoadGameProfiles()
{
if (!File.Exists(GameProfileFile))
{
if (GameProfiles is null) GameProfiles = new List<GameProfile>();
return;
}
string? json = File.ReadAllText(GameProfileFile);
if (json == null)
{
return;
}
try
{
GameProfiles = JsonSerializer.Deserialize<List<GameProfile>>(json);
}
catch (Exception e)
{
Logger.WriteLine("[AutoTDPService] Deserialization failed. Creating empty list. Message: " + e.Message);
GameProfiles = new List<GameProfile>();
}
}
public void CheckForGame()
{
if (currentGame is not null)
{
//Already handling a running game. No need to check for other games
return;
}
List<GameInstance> runningGames = framerateSouce.GetRunningGames();
if (runningGames.Count == 0)
{
if (LOG_AUTO_TDP)
Logger.WriteLine("[AutoTDPService] No games detected");
return;
}
foreach (GameInstance gi in runningGames)
{
if (LOG_AUTO_TDP)
Logger.WriteLine("[AutoTDPService] Detected App: " + gi.ProcessName + " PID: " + gi.ProcessID);
if (IsGameInList(gi.ProcessName))
{
Logger.WriteLine("[AutoTDPService] Detected Supported Game: " + gi.ProcessName + " PID: " + gi.ProcessID);
HandleGame(gi);
return;
}
}
}
public GameProfile? ProfileForGame(String? processName)
{
if (processName is null)
{
return null;
}
foreach (GameProfile gp in GameProfiles)
{
if (gp.ProcessName is not null && processName.EndsWith(gp.ProcessName, StringComparison.CurrentCultureIgnoreCase))
{
return gp;
}
}
return null;
}
public bool IsGameInList(String? processName)
{
return ProfileForGame(processName) is not null;
}
public void HandleGame(GameInstance instance)
{
if (currentGame is not null)
{
if (LOG_AUTO_TDP)
Logger.WriteLine("[AutoTDPService] Already handling a game");
return;
}
if (tdpThread is not null)
{
tdpThread.Join();
tdpThread = null;
}
currentGame = instance;
StartGameHandler(instance);
}
public void Reset()
{
currentGame = null;
GameFPSPrevious = double.NaN;
GameFPS = 0;
LastAdjustmentsWithoutImprovement = 0;
LastAdjustment = 0.0;
FramerateLog = new List<double>();
FramerateTargetReachedCounter = 0;
FramerateDipCounter = 0;
LowestStableStability = 0;
LowestStableChecks = 0;
if (powerLimiter is not null)
{
powerLimiter.ResetPowerLimits();
CurrentTDP = powerLimiter.GetCPUPowerLimit();
}
}
public void StartGameHandler(GameInstance instance)
{
GameProfile? profile = ProfileForGame(instance.ProcessName);
if (profile is null || powerLimiter is null || framerateSouce is null)
{
return;
}
Logger.WriteLine("[AutoTDPService] Start handling game: " + instance.ProcessName + " PID: " + instance.ProcessID);
tdpThread = new Thread(() =>
{
CurrentTDP = powerLimiter.GetCPUPowerLimit();
powerLimiter.SavePowerLimits(); // save current power limits to restore them afterwards
LowestStableTDP = profile.MaxTdp;
LowestTDP = profile.MaxTdp;
while (currentGame is not null && Running)
{
double fps = framerateSouce.GetFramerate(instance);
if (LOG_AUTO_TDP)
Logger.WriteLine("[AutoTDPService] (" + instance.ProcessName + ") Framerate " + GameFPS);
if (fps < 0.0d)
{
//Game is not running anymore or RTSS lost its hook
Reset();
return;
}
//prevent FPS from going to 0 which causes issues with the math
GameFPS = Math.Max(5, fps);
AdjustPowerLimit(profile);
try
{
Thread.Sleep(INTERVAL_FPS_CHECK);
}
catch (ThreadInterruptedException)
{
continue;
}
}
});
tdpThread.Start();
}
private double FPSDipCorrection(double currentFramerate, double targetFPS)
{
double correction = 0.0d;
FramerateLog.Insert(0, currentFramerate);
//Remove last entry when exceeding the desired size.
if (FramerateLog.Count > FPSDipHistorySize)
{
FramerateLog.RemoveAt(FramerateLog.Count - 1);
}
if (targetFPS - 1 <= currentFramerate && currentFramerate <= targetFPS + 1)
{
//Framerate is inside ideal range
FramerateTargetReachedCounter++;
if (FramerateTargetReachedCounter >= 3
&& FramerateTargetReachedCounter < FPSDipHistorySize
&& targetFPS - 0.5 <= FramerateLog.Take(3).Average()
&& FramerateLog.Take(3).Average() - 0.05 <= targetFPS)
{
//short dip
FramerateDipCounter++;
FramerateUnstable();
correction = targetFPS + 0.15 - currentFramerate;
}
else if (FramerateDipCounter >= 4
&& targetFPS - 0.5 <= FramerateLog.Average()
&& FramerateLog.Average() - 0.1 <= targetFPS)
{
//long dip
correction = targetFPS + 0.35 - currentFramerate;
FramerateTargetReachedCounter = FPSDipHistorySize;
FramerateVeryUnstable();
}
else
{
FramerateStable();
}
}
else
{
//Framerate not in target range
correction = 0.0;
FramerateTargetReachedCounter = 0;
FramerateDipCounter = 0;
FramerateStable();
}
ProcessStability();
return correction;
}
private void FramerateStable()
{
LowestStableStability++;
}
private void FramerateUnstable()
{
LowestStableStability -= 15;
}
private void FramerateVeryUnstable()
{
LowestStableStability -= 60;
}
private bool Stabilize()
{
return LowestStableChecks * INTERVAL_FPS_CHECK > INTERVAL_MIN_CHECK;
}
private void ProcessStability()
{
if (!Stabilize()) LowestStableChecks++;
if (LowestStableStability < 0 && Stabilize())
{
//If unstable for too often increase lowest stable TDP
LowestStableTDP += 1;
LowestTDP += 1;
LowestStableStability = 0;
return;
}
if (CurrentTDP > LowestStableTDP - 0.1 && CurrentTDP < LowestStableTDP + 0.1 && Stabilize())
{
LowestStableStability++;
if (LowestStableStability > 120)
{
//if stable for long time try to reduce it again
LowestStableTDP = ProfileForGame(currentGame.ProcessName).MaxTdp;
LowestStableStability = 0;
}
}
if (LowestTDP - 0.25 <= CurrentTDP && CurrentTDP <= LowestTDP + 0.25)
{
LowestStableStability++;
if (LowestStableStability > 10 && Stabilize())
{
LowestStableTDP = LowestTDP + (LowestTDP * 0.10); // Add 10% additional wattage to get a smoother framerate
}
}
if (CurrentTDP < LowestTDP - 0.1 && LowestStableStability > 0)
{
LowestStableStability = 0;
LowestTDP = CurrentTDP;
}
LowestStableStability = Math.Min(LowestStableStability, 150);
}
private double TDPDamper(double currentFramerate)
{
if (double.IsNaN(GameFPSPrevious)) GameFPSPrevious = currentFramerate;
double dF = -0.12d;
// PID Compute
double deltaError = currentFramerate - GameFPSPrevious;
double dT = deltaError / (1020.0 / 1000.0);
double damping = CurrentTDP / currentFramerate * dF * dT;
GameFPSPrevious = currentFramerate;
return damping;
}
public void AdjustPowerLimit(GameProfile profile)
{
if (powerLimiter is null)
{
//Should not happen... but we also don't want it to crash
return;
}
double newPL = CurrentTDP;
double fpsCorrection = FPSDipCorrection(GameFPS, profile.GetTDPFPS());
double delta = profile.GetTDPFPS() - GameFPS - fpsCorrection - 1;
delta = Math.Clamp(delta, -15, 15);
double adjustment = (delta * CurrentTDP / GameFPS) * 0.65;
//Dampen the changes to not change TDP too aggressively which would cause performance issues
adjustment += TDPDamper(GameFPS);
adjustment = Math.Min(adjustment, (CurrentTDP * 0.1));
if (GameFPSPrevious > profile.GetTDPFPS() && GameFPS < profile.GetTDPFPS())
{
if (LOG_AUTO_TDP)
Logger.WriteLine("[AutoTDPService] Single Dip, Ignore");
//single dip. Ignore
return;
}
if (LastAdjustment > 0 && GameFPS <= GameFPSPrevious && adjustment > 0)
{
LastAdjustmentsWithoutImprovement++;
LastAdjustmentTotal += adjustment;
//Wait for 3 consecutive power increases and at least 3W increased TDP before judging that increasing power does nothing.
if (LastAdjustmentsWithoutImprovement >= 3 && LastAdjustmentTotal > 3)
{
//Do not adjust if increasing power does not improve framerate.
if (LOG_AUTO_TDP)
Logger.WriteLine("[AutoTDPService] Not adjusting because no improvement from last increase");
return;
}
}
else
{
LastAdjustmentsWithoutImprovement = 0;
LastAdjustmentTotal = 0;
}
newPL += adjustment;
LastAdjustment = adjustment;
//Respect the limits that the user chose
newPL = Math.Clamp(newPL, profile.MinTdp, profile.MaxTdp);
if (newPL < LowestStableTDP && LowestStableTDP < profile.MaxTdp - 1)
{
newPL = LowestStableTDP;
}
if (LOG_AUTO_TDP)
Logger.WriteLine("[AutoTDPService] Power Limit from " + CurrentTDP + "W to " + newPL + "W, Delta:" + adjustment
+ " Lowest: " + LowestTDP + "W, Lowest Stable(" + LowestStableStability + "): " + LowestStableTDP + "W");
//Apply power limits
powerLimiter.SetCPUPowerLimit(newPL);
CurrentTDP = newPL;
}
public void StopGameHandler()
{
if (tdpThread is not null)
{
currentGame = null;
tdpThread.Join();
tdpThread = null;
}
}
public void Shutdown()
{
Running = false;
if (checkerThread is not null)
{
checkerThread.Interrupt();
checkerThread.Join();
}
if (tdpThread is not null)
{
tdpThread.Interrupt();
tdpThread.Join();
}
if (powerLimiter is not null)
{
powerLimiter.ResetPowerLimits();
powerLimiter.Dispose();
powerLimiter = null;
}
if (framerateSouce is not null)
{
framerateSouce = null;
}
currentGame = null;
Reset();
//Kill RTSS instance if we started one
RTSSFramerateSource.Stop();
}
public void Dispose()
{
Shutdown();
}
}
}

311
app/AutoTDP/AutoTDPUI.Designer.cs generated Normal file
View File

@@ -0,0 +1,311 @@
using GHelper.UI;
namespace GHelper.AutoTDP
{
partial class AutoTDPUI
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
panelPerformanceHeader = new Panel();
pictureKeyboard = new PictureBox();
labelGlobalSettings = new Label();
checkBoxEnabled = new CheckBox();
panelLightingContent = new Panel();
comboBoxFPSSource = new RComboBox();
labelFPSSource = new Label();
comboBoxLimiter = new RComboBox();
labelLimiter = new Label();
buttonAddGame = new RButton();
panelGamesHeader = new Panel();
pictureBox1 = new PictureBox();
labelGames = new Label();
tableLayoutGames = new TableLayoutPanel();
buttonGameDummy = new RButton();
panelPerformanceHeader.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureKeyboard).BeginInit();
panelLightingContent.SuspendLayout();
panelGamesHeader.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
tableLayoutGames.SuspendLayout();
SuspendLayout();
//
// panelPerformanceHeader
//
panelPerformanceHeader.BackColor = SystemColors.ControlLight;
panelPerformanceHeader.Controls.Add(pictureKeyboard);
panelPerformanceHeader.Controls.Add(labelGlobalSettings);
panelPerformanceHeader.Controls.Add(checkBoxEnabled);
panelPerformanceHeader.Dock = DockStyle.Top;
panelPerformanceHeader.Location = new Point(0, 0);
panelPerformanceHeader.Margin = new Padding(2);
panelPerformanceHeader.Name = "panelPerformanceHeader";
panelPerformanceHeader.Size = new Size(446, 30);
panelPerformanceHeader.TabIndex = 52;
//
// pictureKeyboard
//
pictureKeyboard.BackgroundImage = Properties.Resources.icons8_automation_32;
pictureKeyboard.BackgroundImageLayout = ImageLayout.Zoom;
pictureKeyboard.Location = new Point(3, 8);
pictureKeyboard.Margin = new Padding(2);
pictureKeyboard.Name = "pictureKeyboard";
pictureKeyboard.Size = new Size(16, 16);
pictureKeyboard.TabIndex = 35;
pictureKeyboard.TabStop = false;
//
// labelGlobalSettings
//
labelGlobalSettings.AutoSize = true;
labelGlobalSettings.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelGlobalSettings.Location = new Point(22, 8);
labelGlobalSettings.Margin = new Padding(4, 0, 4, 0);
labelGlobalSettings.Name = "labelGlobalSettings";
labelGlobalSettings.Size = new Size(100, 15);
labelGlobalSettings.TabIndex = 34;
labelGlobalSettings.Text = "General Settings";
//
// checkBoxEnabled
//
checkBoxEnabled.Location = new Point(244, 4);
checkBoxEnabled.Margin = new Padding(4, 0, 4, 0);
checkBoxEnabled.Name = "checkBoxEnabled";
checkBoxEnabled.Size = new Size(198, 25);
checkBoxEnabled.TabIndex = 53;
checkBoxEnabled.Text = "Enabled";
checkBoxEnabled.UseVisualStyleBackColor = true;
//
// panelLightingContent
//
panelLightingContent.AutoSize = true;
panelLightingContent.Controls.Add(comboBoxFPSSource);
panelLightingContent.Controls.Add(labelFPSSource);
panelLightingContent.Controls.Add(comboBoxLimiter);
panelLightingContent.Controls.Add(labelLimiter);
panelLightingContent.Dock = DockStyle.Top;
panelLightingContent.Location = new Point(0, 30);
panelLightingContent.Margin = new Padding(2);
panelLightingContent.Name = "panelLightingContent";
panelLightingContent.Padding = new Padding(0, 0, 0, 7);
panelLightingContent.Size = new Size(446, 67);
panelLightingContent.TabIndex = 56;
//
// comboBoxFPSSource
//
comboBoxFPSSource.BorderColor = Color.White;
comboBoxFPSSource.ButtonColor = Color.FromArgb(255, 255, 255);
comboBoxFPSSource.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxFPSSource.FlatStyle = FlatStyle.Flat;
comboBoxFPSSource.FormattingEnabled = true;
comboBoxFPSSource.Location = new Point(244, 37);
comboBoxFPSSource.Margin = new Padding(11, 0, 11, 0);
comboBoxFPSSource.Name = "comboBoxFPSSource";
comboBoxFPSSource.Size = new Size(191, 23);
comboBoxFPSSource.TabIndex = 56;
//
// labelFPSSource
//
labelFPSSource.Location = new Point(4, 37);
labelFPSSource.Margin = new Padding(4, 0, 4, 0);
labelFPSSource.Name = "labelFPSSource";
labelFPSSource.Size = new Size(211, 22);
labelFPSSource.TabIndex = 57;
labelFPSSource.Text = "FPS Source";
//
// comboBoxLimiter
//
comboBoxLimiter.BorderColor = Color.White;
comboBoxLimiter.ButtonColor = Color.FromArgb(255, 255, 255);
comboBoxLimiter.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxLimiter.FlatStyle = FlatStyle.Flat;
comboBoxLimiter.FormattingEnabled = true;
comboBoxLimiter.Location = new Point(244, 7);
comboBoxLimiter.Margin = new Padding(11, 0, 11, 0);
comboBoxLimiter.Name = "comboBoxLimiter";
comboBoxLimiter.Size = new Size(191, 23);
comboBoxLimiter.TabIndex = 46;
//
// labelLimiter
//
labelLimiter.Location = new Point(4, 7);
labelLimiter.Margin = new Padding(4, 0, 4, 0);
labelLimiter.Name = "labelLimiter";
labelLimiter.Size = new Size(211, 22);
labelLimiter.TabIndex = 47;
labelLimiter.Text = "Power Limiter";
//
// buttonAddGame
//
buttonAddGame.AccessibleName = "Keyboard Color";
buttonAddGame.Activated = false;
buttonAddGame.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonAddGame.BackColor = SystemColors.ButtonHighlight;
buttonAddGame.BorderColor = Color.Transparent;
buttonAddGame.BorderRadius = 2;
buttonAddGame.FlatStyle = FlatStyle.Flat;
buttonAddGame.ForeColor = SystemColors.ControlText;
buttonAddGame.Location = new Point(339, 3);
buttonAddGame.Margin = new Padding(2, 4, 2, 4);
buttonAddGame.Name = "buttonAddGame";
buttonAddGame.Secondary = false;
buttonAddGame.Size = new Size(103, 25);
buttonAddGame.TabIndex = 60;
buttonAddGame.Text = "Add Game";
buttonAddGame.UseVisualStyleBackColor = false;
//
// panelGamesHeader
//
panelGamesHeader.BackColor = SystemColors.ControlLight;
panelGamesHeader.Controls.Add(pictureBox1);
panelGamesHeader.Controls.Add(buttonAddGame);
panelGamesHeader.Controls.Add(labelGames);
panelGamesHeader.Dock = DockStyle.Top;
panelGamesHeader.Location = new Point(0, 97);
panelGamesHeader.Margin = new Padding(2);
panelGamesHeader.Name = "panelGamesHeader";
panelGamesHeader.Size = new Size(446, 30);
panelGamesHeader.TabIndex = 61;
//
// pictureBox1
//
pictureBox1.BackgroundImage = Properties.Resources.icons8_software_32_white;
pictureBox1.BackgroundImageLayout = ImageLayout.Zoom;
pictureBox1.Location = new Point(3, 8);
pictureBox1.Margin = new Padding(2);
pictureBox1.Name = "pictureBox1";
pictureBox1.Size = new Size(16, 16);
pictureBox1.TabIndex = 35;
pictureBox1.TabStop = false;
//
// labelGames
//
labelGames.AutoSize = true;
labelGames.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelGames.Location = new Point(22, 8);
labelGames.Margin = new Padding(4, 0, 4, 0);
labelGames.Name = "labelGames";
labelGames.Size = new Size(45, 15);
labelGames.TabIndex = 34;
labelGames.Text = "Games";
//
// tableLayoutGames
//
tableLayoutGames.AutoSize = true;
tableLayoutGames.AutoSizeMode = AutoSizeMode.GrowAndShrink;
tableLayoutGames.ColumnCount = 4;
tableLayoutGames.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableLayoutGames.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableLayoutGames.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableLayoutGames.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableLayoutGames.Controls.Add(buttonGameDummy, 0, 0);
tableLayoutGames.Dock = DockStyle.Top;
tableLayoutGames.Location = new Point(0, 127);
tableLayoutGames.Margin = new Padding(4, 2, 4, 2);
tableLayoutGames.Name = "tableLayoutGames";
tableLayoutGames.RowCount = 7;
tableLayoutGames.RowStyles.Add(new RowStyle(SizeType.Absolute, 60F));
tableLayoutGames.RowStyles.Add(new RowStyle(SizeType.Absolute, 60F));
tableLayoutGames.RowStyles.Add(new RowStyle(SizeType.Absolute, 60F));
tableLayoutGames.RowStyles.Add(new RowStyle(SizeType.Absolute, 60F));
tableLayoutGames.RowStyles.Add(new RowStyle(SizeType.Absolute, 60F));
tableLayoutGames.RowStyles.Add(new RowStyle(SizeType.Absolute, 60F));
tableLayoutGames.RowStyles.Add(new RowStyle(SizeType.Absolute, 60F));
tableLayoutGames.Size = new Size(446, 420);
tableLayoutGames.TabIndex = 62;
//
// buttonGameDummy
//
buttonGameDummy.AccessibleName = "DPI Setting 4";
buttonGameDummy.Activated = false;
buttonGameDummy.AutoSize = true;
buttonGameDummy.AutoSizeMode = AutoSizeMode.GrowAndShrink;
buttonGameDummy.BackColor = SystemColors.ControlLightLight;
buttonGameDummy.BorderColor = Color.LightGreen;
buttonGameDummy.BorderRadius = 5;
buttonGameDummy.Dock = DockStyle.Fill;
buttonGameDummy.FlatAppearance.BorderSize = 0;
buttonGameDummy.FlatStyle = FlatStyle.Flat;
buttonGameDummy.ForeColor = SystemColors.ControlText;
buttonGameDummy.ImageAlign = ContentAlignment.BottomCenter;
buttonGameDummy.Location = new Point(2, 2);
buttonGameDummy.Margin = new Padding(2);
buttonGameDummy.Name = "buttonGameDummy";
buttonGameDummy.Secondary = false;
buttonGameDummy.Size = new Size(107, 56);
buttonGameDummy.TabIndex = 7;
buttonGameDummy.Text = "Genshin Impact\r\n60FPS\r\n";
buttonGameDummy.TextImageRelation = TextImageRelation.ImageAboveText;
buttonGameDummy.UseVisualStyleBackColor = false;
buttonGameDummy.Visible = false;
//
// AutoTDPUI
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(446, 547);
Controls.Add(tableLayoutGames);
Controls.Add(panelGamesHeader);
Controls.Add(panelLightingContent);
Controls.Add(panelPerformanceHeader);
FormBorderStyle = FormBorderStyle.FixedSingle;
MaximizeBox = false;
MinimizeBox = false;
Name = "AutoTDPUI";
ShowIcon = false;
Text = "Auto TDP Settings";
panelPerformanceHeader.ResumeLayout(false);
panelPerformanceHeader.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureKeyboard).EndInit();
panelLightingContent.ResumeLayout(false);
panelGamesHeader.ResumeLayout(false);
panelGamesHeader.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
tableLayoutGames.ResumeLayout(false);
tableLayoutGames.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Panel panelPerformanceHeader;
private PictureBox pictureKeyboard;
private Label labelGlobalSettings;
private Panel panelLightingContent;
private TableLayoutPanel tableLayoutGames;
private UI.RButton rButton1;
private CheckBox checkBoxEnabled;
private UI.RComboBox comboBoxLightingMode;
private Label labelLimiter;
private UI.RComboBox comboBoxFPSSource;
private Label labelFPSSource;
private RComboBox comboBoxLimiter;
private RButton buttonAddGame;
private Panel panelGamesHeader;
private PictureBox pictureBox1;
private Label labelGames;
private RButton buttonGameDummy;
}
}

220
app/AutoTDP/AutoTDPUI.cs Normal file
View File

@@ -0,0 +1,220 @@
using GHelper.AutoTDP.FramerateSource;
using GHelper.AutoTDP.PowerLimiter;
using GHelper.UI;
using Ryzen;
using System.Linq;
namespace GHelper.AutoTDP
{
public partial class AutoTDPUI : RForm
{
private Dictionary<string, string> ModeTexts = new Dictionary<string, string>();
private AutoTDPGameProfileUI? profileUI;
public AutoTDPUI()
{
InitializeComponent();
InitTheme();
ModeTexts.Add("intel_msr", "Intel MSR Power Limiter");
ModeTexts.Add("asus_acpi", "ASUS ACPI Power Limiter");
ModeTexts.Add("rtss", "Riva Tuner Statistics Server");
checkBoxEnabled.CheckedChanged += CheckBoxEnabled_CheckedChanged;
buttonAddGame.Click += ButtonAddGame_Click;
comboBoxLimiter.DropDownClosed += ComboBoxLimiter_DropDownClosed;
comboBoxFPSSource.DropDownClosed += ComboBoxFPSSource_DropDownClosed;
Shown += AutoTDPUI_Shown;
VisualizeGeneralSettings();
VizualizeGameList();
}
private void ComboBoxFPSSource_DropDownClosed(object? sender, EventArgs e)
{
AppConfig.Set("auto_tdp_fps_source", AutoTDPService.AvailableFramerateSources().ElementAt(comboBoxFPSSource.SelectedIndex));
}
private void ComboBoxLimiter_DropDownClosed(object? sender, EventArgs e)
{
AppConfig.Set("auto_tdp_limiter", AutoTDPService.AvailablePowerLimiters().ElementAt(comboBoxLimiter.SelectedIndex));
}
private void CheckBoxEnabled_CheckedChanged(object? sender, EventArgs e)
{
AppConfig.Set("auto_tdp_enabled", checkBoxEnabled.Checked ? 1 : 0);
if (Program.autoTDPService.IsEnabled())
{
Program.autoTDPService.Start();
}
else
{
Program.autoTDPService.Shutdown();
}
}
private void ButtonAddGame_Click(object? sender, EventArgs e)
{
string? path = null;
Thread t = new Thread(() =>
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Executables (*.exe)|*.exe";
if (ofd.ShowDialog() == DialogResult.OK)
{
path = ofd.FileName;
}
});
t.SetApartmentState(ApartmentState.STA);
t.Start();
t.Join();
if (path is null)
{
//User did not select a file
return;
}
GameProfile p = new GameProfile();
p.ProcessName = Path.GetFileName(path);
p.GameTitle = Path.GetFileName(path).Replace(".exe", "");
p.Enabled = true;
p.TargetFPS = 60;
p.MaxTdp = 40;
p.MinTdp = 15;
profileUI = new AutoTDPGameProfileUI(p, this);
profileUI.FormClosed += ProfileUI_FormClosed;
profileUI.ShowDialog(this);
}
private void ProfileUI_FormClosed(object? sender, FormClosedEventArgs e)
{
profileUI = null;
}
private void AutoTDPUI_Shown(object? sender, EventArgs e)
{
if (Height > Program.settingsForm.Height)
{
Top = Program.settingsForm.Top + Program.settingsForm.Height - Height;
}
else
{
Top = Program.settingsForm.Top;
}
Left = Program.settingsForm.Left - Width - 5;
}
private void VisualizeGeneralSettings()
{
checkBoxEnabled.Checked = AppConfig.Get("auto_tdp_enabled", 0) == 1;
comboBoxLimiter.Items.Clear();
comboBoxFPSSource.Items.Clear();
foreach (string s in AutoTDPService.AvailablePowerLimiters())
{
comboBoxLimiter.Items.Add(ModeTexts[s]);
}
foreach (string s in AutoTDPService.AvailableFramerateSources())
{
comboBoxFPSSource.Items.Add(ModeTexts[s]);
}
string? limiter = AppConfig.GetString("auto_tdp_limiter", null);
string? source = AppConfig.GetString("auto_tdp_fps_source", null);
if (limiter is not null && AutoTDPService.AvailablePowerLimiters().Contains(limiter))
{
comboBoxLimiter.SelectedIndex = AutoTDPService.AvailablePowerLimiters().IndexOf(limiter);
}
else
{
comboBoxLimiter.SelectedIndex = 0;
}
if (source is not null && AutoTDPService.AvailableFramerateSources().Contains(source))
{
comboBoxFPSSource.SelectedIndex = AutoTDPService.AvailableFramerateSources().IndexOf(source);
}
else
{
comboBoxFPSSource.SelectedIndex = 0;
}
}
private void VizualizeGameList()
{
//Due to my lousy skills in UI design, the game table is limited to 7x4 games.
buttonAddGame.Enabled = Program.autoTDPService.GameProfiles.Count < 7 * 4;
tableLayoutGames.Controls.Clear();
foreach (GameProfile gp in Program.autoTDPService.GameProfiles)
{
RButton bt = new RButton();
bt.Text = gp.GameTitle + "\n" + gp.TargetFPS + " FPS";
bt.Dock = DockStyle.Fill;
bt.FlatStyle = FlatStyle.Flat;
bt.FlatAppearance.BorderColor = RForm.borderMain;
bt.UseVisualStyleBackColor = false;
bt.AutoSize = true;
bt.AutoSizeMode = AutoSizeMode.GrowAndShrink;
bt.BackColor = RForm.buttonMain;
bt.ForeColor = RForm.foreMain;
bt.Click += Bt_Click;
bt.Tag = gp;
tableLayoutGames.Controls.Add(bt);
}
}
private void Bt_Click(object? sender, EventArgs e)
{
GameProfile gp = (GameProfile)((RButton)sender).Tag;
profileUI = new AutoTDPGameProfileUI(gp, this);
profileUI.FormClosed += ProfileUI_FormClosed;
profileUI.ShowDialog(this);
}
public void DeleteGameProfile(GameProfile gp)
{
if (Program.autoTDPService.IsGameInList(gp.ProcessName))
{
Program.autoTDPService.GameProfiles.Remove(gp);
}
Program.autoTDPService.SaveGameProfiles();
VizualizeGameList();
}
public void UpdateGameProfile(GameProfile gp)
{
if (!Program.autoTDPService.IsGameInList(gp.ProcessName))
{
Program.autoTDPService.GameProfiles.Add(gp);
}
Program.autoTDPService.SaveGameProfiles();
VizualizeGameList();
}
}
}

120
app/AutoTDP/AutoTDPUI.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,17 @@
namespace GHelper.AutoTDP.FramerateSource
{
internal class GameInstance
{
public string? ProcessName { get; set; }
public int ProcessID { get; set; }
}
internal interface IFramerateSource
{
public double GetFramerate(GameInstance instance);
public List<GameInstance> GetRunningGames();
}
}

View File

@@ -0,0 +1,130 @@
using System.Diagnostics;
using RTSSSharedMemoryNET;
namespace GHelper.AutoTDP.FramerateSource
{
internal class RTSSFramerateSource : IFramerateSource
{
private static Process? rtssInstance;
private static OSD? osd;
public static string RTSSPath { get; set; }
public static bool IsRunning => Process.GetProcessesByName("RTSS").Length != 0;
static RTSSFramerateSource()
{
RTSSPath = @"C:\Program Files (x86)\RivaTuner Statistics Server\RTSS.exe";
}
public static bool IsAvailable()
{
return File.Exists(RTSSPath);
}
public static void Start()
{
if ((rtssInstance == null || rtssInstance.HasExited) && !IsRunning && File.Exists(RTSSPath))
{
try
{
rtssInstance = Process.Start(RTSSPath);
Thread.Sleep(2000); // If it works, don't touch it
}
catch (Exception exc)
{
Logger.WriteLine("Could not start RTSS Service" + exc.Message);
}
RunOSD();
}
else
{
RunOSD();
}
}
public List<GameInstance> GetRunningGames()
{
if (!IsRunning)
{
return new List<GameInstance>();
}
List<GameInstance> giL = new List<GameInstance>();
foreach (AppEntry appEntry in OSD.GetAppEntries())
{
GameInstance i = new GameInstance();
i.ProcessID = appEntry.ProcessId;
i.ProcessName = appEntry.Name;
giL.Add(i);
}
return giL;
}
public double GetFramerate(GameInstance instance)
{
if (!IsRunning)
{
return -1.0d;
}
try
{
var appE = OSD.GetAppEntries().FirstOrDefault(a => a.ProcessId == instance.ProcessID);
if (appE is null)
return -1.0d;
return (double)appE.StatFrameTimeBufFramerate / 10;
}
catch (InvalidDataException)
{
}
catch (FileNotFoundException)
{
}
return -1.0d;
}
public static void RunOSD()
{
if (osd == null)
{
try
{
osd = new OSD("GHELPER");
}
catch (Exception exc)
{
Logger.WriteLine("Could not start OSD" + exc.Message);
}
}
}
public static void Stop()
{
if (rtssInstance != null && !rtssInstance.HasExited)
{
try
{
rtssInstance.Kill();
rtssInstance = null;
var proc = Process.GetProcessesByName("RTSSHooksLoader64");
proc[0].Kill();
}
catch (Exception)
{
// Ignored
}
}
}
}
}

View File

@@ -0,0 +1,18 @@
namespace GHelper.AutoTDP
{
public class GameProfile
{
public string GameTitle { get; set; }
public string ProcessName { get; set; }
public int TargetFPS { get; set; }
public int MinTdp { get; set; }
public int MaxTdp { get; set; }
public bool Enabled { get; set; }
public int GetTDPFPS()
{
return TargetFPS - 1;
}
}
}

View File

@@ -0,0 +1,57 @@
using GHelper.Mode;
namespace GHelper.AutoTDP.PowerLimiter
{
internal class ASUSACPIPowerLimiter : IPowerLimiter
{
private bool allAmd;
private bool fPPT;
public ASUSACPIPowerLimiter()
{
allAmd = Program.acpi.IsAllAmdPPT();
fPPT = Program.acpi.DeviceGet(AsusACPI.PPT_APUC1) >= 0;
}
public static bool IsAvailable()
{
return AppConfig.IsASUS();
}
public void SavePowerLimits()
{
}
public void SetCPUPowerLimit(double watts)
{
if (allAmd) // CPU limit all amd models
{
Program.acpi.DeviceSet(AsusACPI.PPT_CPUB0, (int)watts, "PowerLimit B0");
} else {
Program.acpi.DeviceSet(AsusACPI.PPT_APUA3, (int)watts, "PowerLimit A3");
Program.acpi.DeviceSet(AsusACPI.PPT_APUA0, (int)watts, "PowerLimit A0");
if (fPPT) Program.acpi.DeviceSet(AsusACPI.PPT_APUC1, (int)watts, "PowerLimit C1");
}
}
// You can't read PPTs on ASUS :) endpoints just return 0 if they are available
public int GetCPUPowerLimit()
{
return Program.acpi.DeviceGet(AsusACPI.PPT_APUA0);
}
public void Dispose()
{
//Nothing to dispose here
}
// Correct Asus way to reset everything, is just to set mode again
public void ResetPowerLimits()
{
Program.modeControl.SetPerformanceMode(Modes.GetCurrent());
}
}
}

View File

@@ -0,0 +1,14 @@
namespace GHelper.AutoTDP.PowerLimiter
{
internal interface IPowerLimiter : IDisposable
{
public void SetCPUPowerLimit(double watts);
public int GetCPUPowerLimit();
public void ResetPowerLimits();
public void SavePowerLimits();
}
}

View File

@@ -0,0 +1,110 @@
using Ryzen;
namespace GHelper.AutoTDP.PowerLimiter
{
internal class IntelMSRPowerLimiter : IPowerLimiter
{
public static readonly uint MSR_PKG_POWER_LIMIT = 0x610;
public static readonly uint MSR_RAPL_POWER_UNIT = 0x606;
private Ols ols;
private uint DefaultEax = 0; // Set on first reading
private uint DefaultEdx = 0;
//Lower 14 bits are the power limits
private uint PL1_MASK = 0x3FFF;
private uint PL2_MASK = 0x3FFF;
//The power unit factor (Default is 0.125 for most Intel CPUs).
private double PowerUnit = 0x0;
public IntelMSRPowerLimiter()
{
ols = new Ols();
ols.InitializeOls();
ReadPowerUnit();
}
public static bool IsAvailable()
{
return !RyzenControl.IsAMD();
}
public void SavePowerLimits()
{
DefaultEax = 0;
DefaultEdx = 0;
ols.Rdmsr(MSR_PKG_POWER_LIMIT, ref DefaultEax, ref DefaultEdx);
}
public void ReadPowerUnit()
{
uint eax = 0;
uint edx = 0;
ols.Rdmsr(MSR_RAPL_POWER_UNIT, ref eax, ref edx);
uint pwr = eax & 0x03;
PowerUnit = 1 / Math.Pow(2, pwr);
}
public void SetCPUPowerLimit(double watts)
{
uint eax = 0;
uint edx = 0;
ols.Rdmsr(MSR_PKG_POWER_LIMIT, ref eax, ref edx);
uint watsRapl = (uint)(watts / PowerUnit);
//Set limits for both PL1 and PL2
uint eaxFilterd = eax & ~PL1_MASK;
uint edxFilterd = edx & ~PL2_MASK;
eaxFilterd |= watsRapl;
edxFilterd |= watsRapl;
//Enable clamping
eaxFilterd |= 0x8000;
edxFilterd |= 0x8000;
ols.Wrmsr(0x610, eaxFilterd, edxFilterd);
}
public int GetCPUPowerLimit()
{
uint eax = 0;
uint edx = 0;
ols.Rdmsr(MSR_PKG_POWER_LIMIT, ref eax, ref edx);
uint pl1 = eax & PL1_MASK;
uint pl2 = edx & PL2_MASK;
return (int)(pl1 * PowerUnit);
}
public void ResetPowerLimits()
{
if (DefaultEax == 0)
{
return;
}
ols.Wrmsr(MSR_PKG_POWER_LIMIT, DefaultEax, DefaultEdx);
}
public void Dispose()
{
ols.DeinitializeOls();
ols.Dispose();
}
}
}

View File

@@ -24,29 +24,17 @@ namespace GHelper.Display
}
}
public void SaveGamma()
public void SetBrightness(int brightness = -1)
{
var screenName = ScreenNative.FindLaptopScreen();
if (screenName is null) return;
if (!AppConfig.IsOLED()) return;
try
{
var handle = ScreenNative.CreateDC(screenName, screenName, null, IntPtr.Zero);
var gammaRamp = new GammaRamp();
if (ScreenNative.GetDeviceGammaRamp(handle, ref gammaRamp))
{
var gamma = new DisplayGammaRamp(gammaRamp);
Logger.WriteLine("Gamma R: " + string.Join("-", gamma.Red));
Logger.WriteLine("Gamma G: " + string.Join("-", gamma.Green));
Logger.WriteLine("Gamma B: " + string.Join("-", gamma.Blue));
}
}
catch (Exception ex)
{
Logger.WriteLine(ex.ToString());
}
if (brightness >= 0) AppConfig.Set("brightness", brightness);
else brightness = AppConfig.Get("brightness");
if (brightness >= 0) SetGamma(brightness);
}
public void SetGamma(int brightness = 100)
{
var bright = Math.Round((float)brightness / 200 + 0.5, 2);
@@ -63,15 +51,15 @@ namespace GHelper.Display
if (ScreenNative.GetDeviceGammaRamp(handle, ref gammaDump))
{
gammaRamp = new DisplayGammaRamp(gammaDump);
Logger.WriteLine("Gamma R: " + string.Join("-", gammaRamp.Red));
Logger.WriteLine("Gamma G: " + string.Join("-", gammaRamp.Green));
Logger.WriteLine("Gamma B: " + string.Join("-", gammaRamp.Blue));
//Logger.WriteLine("Gamma R: " + string.Join("-", gammaRamp.Red));
//Logger.WriteLine("Gamma G: " + string.Join("-", gammaRamp.Green));
//Logger.WriteLine("Gamma B: " + string.Join("-", gammaRamp.Blue));
}
}
if (gammaRamp is null || !gammaRamp.IsOriginal())
{
Logger.WriteLine("Default Gamma");
Logger.WriteLine("Not default Gamma");
gammaRamp = new DisplayGammaRamp();
}

View File

@@ -339,7 +339,20 @@ namespace GHelper.Display
for (var i = 0; i < modeCount; i++)
if (displayModes[i].infoType == DISPLAYCONFIG_MODE_INFO_TYPE.DISPLAYCONFIG_MODE_INFO_TYPE_TARGET)
yield return DeviceName(displayModes[i].adapterId, displayModes[i].id);
{
DISPLAYCONFIG_TARGET_DEVICE_NAME? displayName = null;
try
{
displayName = DeviceName(displayModes[i].adapterId, displayModes[i].id);
} catch (Exception e)
{
Logger.WriteLine(e.Message);
}
if (displayName is not null) yield return (DISPLAYCONFIG_TARGET_DEVICE_NAME)displayName;
}
}

View File

@@ -42,6 +42,12 @@ namespace GHelper.Display
[DllImport("gdi32")]
internal static extern bool GetDeviceGammaRamp(IntPtr dcHandle, ref GammaRamp ramp);
[DllImport("gdi32", CharSet = CharSet.Unicode)]
internal static extern bool SetICMProfileW(IntPtr dcHandle, string lpFileName);
[DllImport("gdi32", CharSet = CharSet.Unicode)]
internal static extern bool SetICMMode(IntPtr dcHandle, int mode);
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct DEVMODE
{

240
app/Extra.Designer.cs generated
View File

@@ -99,6 +99,7 @@ namespace GHelper
checkSleepLid = new CheckBox();
checkShutdownLid = new CheckBox();
panelSettingsHeader = new Panel();
pictureScan = new PictureBox();
pictureLog = new PictureBox();
pictureSettings = new PictureBox();
labelSettings = new Label();
@@ -120,7 +121,18 @@ namespace GHelper
comboAPU = new RComboBox();
pictureAPUMem = new PictureBox();
labelAPUMem = new Label();
pictureScan = new PictureBox();
panelCores = new Panel();
buttonCores = new RButton();
comboCoresP = new RComboBox();
comboCoresE = new RComboBox();
pictureCores = new PictureBox();
label1 = new Label();
panelACPI = new Panel();
textACPIParam = new TextBox();
textACPICommand = new TextBox();
buttonACPISend = new RButton();
pictureDebug = new PictureBox();
labelACPITitle = new Label();
panelServices.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureService).BeginInit();
panelBindingsHeader.SuspendLayout();
@@ -137,6 +149,7 @@ namespace GHelper
panelXMG.SuspendLayout();
tableBacklight.SuspendLayout();
panelSettingsHeader.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureScan).BeginInit();
((System.ComponentModel.ISupportInitialize)pictureLog).BeginInit();
((System.ComponentModel.ISupportInitialize)pictureSettings).BeginInit();
panelSettings.SuspendLayout();
@@ -145,7 +158,10 @@ namespace GHelper
((System.ComponentModel.ISupportInitialize)pictureHibernate).BeginInit();
panelAPU.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureAPUMem).BeginInit();
((System.ComponentModel.ISupportInitialize)pictureScan).BeginInit();
panelCores.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureCores).BeginInit();
panelACPI.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureDebug).BeginInit();
SuspendLayout();
//
// panelServices
@@ -155,7 +171,7 @@ namespace GHelper
panelServices.Controls.Add(labelServices);
panelServices.Controls.Add(buttonServices);
panelServices.Dock = DockStyle.Top;
panelServices.Location = new Point(15, 1378);
panelServices.Location = new Point(15, 1508);
panelServices.Name = "panelServices";
panelServices.Size = new Size(983, 75);
panelServices.TabIndex = 5;
@@ -1016,6 +1032,20 @@ namespace GHelper
panelSettingsHeader.Size = new Size(983, 51);
panelSettingsHeader.TabIndex = 45;
//
// pictureScan
//
pictureScan.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pictureScan.BackgroundImage = Resources.icons8_search_32;
pictureScan.BackgroundImageLayout = ImageLayout.Zoom;
pictureScan.Cursor = Cursors.Hand;
pictureScan.Location = new Point(891, 11);
pictureScan.Margin = new Padding(4, 3, 4, 3);
pictureScan.Name = "pictureScan";
pictureScan.Size = new Size(32, 32);
pictureScan.TabIndex = 13;
pictureScan.TabStop = false;
pictureScan.Visible = false;
//
// pictureLog
//
pictureLog.Anchor = AnchorStyles.Top | AnchorStyles.Right;
@@ -1063,7 +1093,7 @@ namespace GHelper
panelSettings.Controls.Add(checkGpuApps);
panelSettings.Controls.Add(checkGPUFix);
panelSettings.Dock = DockStyle.Top;
panelSettings.Location = new Point(15, 978);
panelSettings.Location = new Point(15, 1108);
panelSettings.Name = "panelSettings";
panelSettings.Padding = new Padding(20, 5, 11, 5);
panelSettings.Size = new Size(983, 346);
@@ -1178,7 +1208,7 @@ namespace GHelper
panelPower.Controls.Add(labelHibernateAfter);
panelPower.Controls.Add(pictureHibernate);
panelPower.Dock = DockStyle.Top;
panelPower.Location = new Point(15, 1324);
panelPower.Location = new Point(15, 1454);
panelPower.Name = "panelPower";
panelPower.Size = new Size(983, 54);
panelPower.TabIndex = 4;
@@ -1221,7 +1251,7 @@ namespace GHelper
panelAPU.Controls.Add(pictureAPUMem);
panelAPU.Controls.Add(labelAPUMem);
panelAPU.Dock = DockStyle.Top;
panelAPU.Location = new Point(15, 921);
panelAPU.Location = new Point(15, 1051);
panelAPU.Name = "panelAPU";
panelAPU.Padding = new Padding(11, 5, 11, 0);
panelAPU.Size = new Size(983, 57);
@@ -1239,10 +1269,10 @@ namespace GHelper
comboAPU.FormattingEnabled = true;
comboAPU.ItemHeight = 32;
comboAPU.Items.AddRange(new object[] { "Auto", "1G", "2G", "3G", "4G", "5G", "6G", "7G", "8G" });
comboAPU.Location = new Point(663, 8);
comboAPU.Location = new Point(654, 8);
comboAPU.Margin = new Padding(4, 12, 4, 9);
comboAPU.Name = "comboAPU";
comboAPU.Size = new Size(293, 40);
comboAPU.Size = new Size(309, 40);
comboAPU.TabIndex = 12;
comboAPU.TabStop = false;
//
@@ -1260,25 +1290,169 @@ namespace GHelper
//
labelAPUMem.AutoSize = true;
labelAPUMem.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelAPUMem.Location = new Point(56, 11);
labelAPUMem.Location = new Point(64, 11);
labelAPUMem.Name = "labelAPUMem";
labelAPUMem.Size = new Size(309, 32);
labelAPUMem.TabIndex = 0;
labelAPUMem.Text = "Memory Assigned to GPU";
//
// pictureScan
// panelCores
//
pictureScan.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pictureScan.BackgroundImage = Resources.icons8_heartbeat_32;
pictureScan.BackgroundImageLayout = ImageLayout.Zoom;
pictureScan.Cursor = Cursors.Hand;
pictureScan.Location = new Point(891, 11);
pictureScan.Margin = new Padding(4, 3, 4, 3);
pictureScan.Name = "pictureScan";
pictureScan.Size = new Size(32, 32);
pictureScan.TabIndex = 13;
pictureScan.TabStop = false;
pictureScan.Visible = false;
panelCores.AutoSize = true;
panelCores.Controls.Add(buttonCores);
panelCores.Controls.Add(comboCoresP);
panelCores.Controls.Add(comboCoresE);
panelCores.Controls.Add(pictureCores);
panelCores.Controls.Add(label1);
panelCores.Dock = DockStyle.Top;
panelCores.Location = new Point(15, 990);
panelCores.Name = "panelCores";
panelCores.Padding = new Padding(11, 5, 11, 0);
panelCores.Size = new Size(983, 61);
panelCores.TabIndex = 47;
panelCores.Visible = false;
//
// buttonCores
//
buttonCores.Activated = false;
buttonCores.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonCores.BackColor = SystemColors.ButtonHighlight;
buttonCores.BorderColor = Color.Transparent;
buttonCores.BorderRadius = 2;
buttonCores.FlatStyle = FlatStyle.Flat;
buttonCores.Location = new Point(856, 7);
buttonCores.Margin = new Padding(4, 3, 4, 3);
buttonCores.Name = "buttonCores";
buttonCores.Secondary = false;
buttonCores.Size = new Size(106, 46);
buttonCores.TabIndex = 20;
buttonCores.Text = "Apply";
buttonCores.UseVisualStyleBackColor = false;
//
// comboCoresP
//
comboCoresP.Anchor = AnchorStyles.Top | AnchorStyles.Right;
comboCoresP.BorderColor = Color.White;
comboCoresP.ButtonColor = SystemColors.ControlLight;
comboCoresP.FlatStyle = FlatStyle.Flat;
comboCoresP.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
comboCoresP.FormattingEnabled = true;
comboCoresP.ItemHeight = 32;
comboCoresP.Location = new Point(543, 10);
comboCoresP.Margin = new Padding(4, 12, 4, 9);
comboCoresP.Name = "comboCoresP";
comboCoresP.Size = new Size(150, 40);
comboCoresP.TabIndex = 13;
comboCoresP.TabStop = false;
//
// comboCoresE
//
comboCoresE.Anchor = AnchorStyles.Top | AnchorStyles.Right;
comboCoresE.BorderColor = Color.White;
comboCoresE.ButtonColor = SystemColors.ControlLight;
comboCoresE.FlatStyle = FlatStyle.Flat;
comboCoresE.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
comboCoresE.FormattingEnabled = true;
comboCoresE.ItemHeight = 32;
comboCoresE.Location = new Point(702, 10);
comboCoresE.Margin = new Padding(4, 12, 4, 9);
comboCoresE.Name = "comboCoresE";
comboCoresE.Size = new Size(150, 40);
comboCoresE.TabIndex = 12;
comboCoresE.TabStop = false;
//
// pictureCores
//
pictureCores.BackgroundImage = Resources.icons8_processor_32;
pictureCores.BackgroundImageLayout = ImageLayout.Zoom;
pictureCores.Location = new Point(20, 15);
pictureCores.Name = "pictureCores";
pictureCores.Size = new Size(32, 32);
pictureCores.TabIndex = 1;
pictureCores.TabStop = false;
//
// label1
//
label1.AutoSize = true;
label1.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
label1.Location = new Point(64, 14);
label1.Name = "label1";
label1.Size = new Size(299, 32);
label1.TabIndex = 0;
label1.Text = "CPU Cores Configuration";
//
// panelACPI
//
panelACPI.AutoSize = true;
panelACPI.Controls.Add(textACPIParam);
panelACPI.Controls.Add(textACPICommand);
panelACPI.Controls.Add(buttonACPISend);
panelACPI.Controls.Add(pictureDebug);
panelACPI.Controls.Add(labelACPITitle);
panelACPI.Dock = DockStyle.Top;
panelACPI.Location = new Point(15, 921);
panelACPI.Name = "panelACPI";
panelACPI.Padding = new Padding(11, 5, 11, 0);
panelACPI.Size = new Size(983, 69);
panelACPI.TabIndex = 48;
panelACPI.Visible = false;
//
// textACPIParam
//
textACPIParam.Location = new Point(717, 18);
textACPIParam.Margin = new Padding(4, 3, 4, 3);
textACPIParam.Name = "textACPIParam";
textACPIParam.PlaceholderText = "Value";
textACPIParam.Size = new Size(127, 39);
textACPIParam.TabIndex = 22;
textACPIParam.TabStop = false;
//
// textACPICommand
//
textACPICommand.Location = new Point(467, 18);
textACPICommand.Margin = new Padding(4, 3, 4, 3);
textACPICommand.Name = "textACPICommand";
textACPICommand.PlaceholderText = "Address";
textACPICommand.Size = new Size(242, 39);
textACPICommand.TabIndex = 21;
textACPICommand.TabStop = false;
//
// buttonACPISend
//
buttonACPISend.Activated = false;
buttonACPISend.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonACPISend.BackColor = SystemColors.ButtonHighlight;
buttonACPISend.BorderColor = Color.Transparent;
buttonACPISend.BorderRadius = 2;
buttonACPISend.FlatStyle = FlatStyle.Flat;
buttonACPISend.Location = new Point(854, 13);
buttonACPISend.Margin = new Padding(4, 3, 4, 3);
buttonACPISend.Name = "buttonACPISend";
buttonACPISend.Secondary = false;
buttonACPISend.Size = new Size(106, 46);
buttonACPISend.TabIndex = 20;
buttonACPISend.Text = "Send";
buttonACPISend.UseVisualStyleBackColor = false;
//
// pictureDebug
//
pictureDebug.BackgroundImage = Resources.icons8_heartbeat_32;
pictureDebug.BackgroundImageLayout = ImageLayout.Zoom;
pictureDebug.Location = new Point(20, 20);
pictureDebug.Name = "pictureDebug";
pictureDebug.Size = new Size(32, 32);
pictureDebug.TabIndex = 1;
pictureDebug.TabStop = false;
//
// labelACPITitle
//
labelACPITitle.AutoSize = true;
labelACPITitle.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelACPITitle.Location = new Point(57, 20);
labelACPITitle.Name = "labelACPITitle";
labelACPITitle.Size = new Size(188, 32);
labelACPITitle.TabIndex = 0;
labelACPITitle.Text = "ACPI DEVS Test";
//
// Extra
//
@@ -1287,11 +1461,13 @@ namespace GHelper
AutoScroll = true;
AutoSize = true;
AutoSizeMode = AutoSizeMode.GrowAndShrink;
ClientSize = new Size(1013, 1515);
ClientSize = new Size(1013, 1612);
Controls.Add(panelServices);
Controls.Add(panelPower);
Controls.Add(panelSettings);
Controls.Add(panelAPU);
Controls.Add(panelCores);
Controls.Add(panelACPI);
Controls.Add(panelSettingsHeader);
Controls.Add(panelBacklight);
Controls.Add(panelBacklightHeader);
@@ -1332,6 +1508,7 @@ namespace GHelper
tableBacklight.ResumeLayout(false);
panelSettingsHeader.ResumeLayout(false);
panelSettingsHeader.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureScan).EndInit();
((System.ComponentModel.ISupportInitialize)pictureLog).EndInit();
((System.ComponentModel.ISupportInitialize)pictureSettings).EndInit();
panelSettings.ResumeLayout(false);
@@ -1343,7 +1520,12 @@ namespace GHelper
panelAPU.ResumeLayout(false);
panelAPU.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureAPUMem).EndInit();
((System.ComponentModel.ISupportInitialize)pictureScan).EndInit();
panelCores.ResumeLayout(false);
panelCores.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureCores).EndInit();
panelACPI.ResumeLayout(false);
panelACPI.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureDebug).EndInit();
ResumeLayout(false);
PerformLayout();
}
@@ -1439,5 +1621,17 @@ namespace GHelper
private Label labelAPUMem;
private RComboBox comboAPU;
private PictureBox pictureScan;
private Panel panelCores;
private RComboBox comboCoresE;
private PictureBox pictureCores;
private Label label1;
private RComboBox comboCoresP;
private RButton buttonCores;
private Panel panelACPI;
private TextBox textACPIParam;
private TextBox textACPICommand;
private RButton buttonACPISend;
private PictureBox pictureDebug;
private Label labelACPITitle;
}
}

View File

@@ -386,7 +386,6 @@ namespace GHelper
buttonServices.Click += ButtonServices_Click;
pictureLog.Click += PictureLog_Click;
pictureScan.Click += PictureScan_Click;
checkGPUFix.Visible = Program.acpi.IsNVidiaGPU();
checkGPUFix.Checked = AppConfig.IsGPUFix();
@@ -394,11 +393,83 @@ namespace GHelper
toolTip.SetToolTip(checkAutoToggleClamshellMode, "Disable sleep on lid close when plugged in and external monitor is connected");
InitCores();
InitVariBright();
InitServices();
InitHibernate();
InitACPITesting();
}
private void InitACPITesting()
{
if (!AppConfig.Is("debug")) return;
pictureScan.Visible = true;
panelACPI.Visible = true;
textACPICommand.Text = "120098";
textACPIParam.Text = "25";
buttonACPISend.Click += ButtonACPISend_Click;
pictureScan.Click += PictureScan_Click;
}
private void ButtonACPISend_Click(object? sender, EventArgs e)
{
try {
int deviceID = Convert.ToInt32(textACPICommand.Text, 16);
int status = Convert.ToInt32(textACPIParam.Text, textACPIParam.Text.Contains("x") ? 16 : 10);
int result = Program.acpi.DeviceSet((uint)deviceID, status, "TestACPI " + deviceID.ToString("X8") + " " + status.ToString("X4"));
labelACPITitle.Text = "ACPI DEVS Test : " + result.ToString();
} catch (Exception ex)
{
Logger.WriteLine(ex.Message);
}
}
private void InitCores()
{
(int eCores, int pCores) = Program.acpi.GetCores();
(int eCoresMax, int pCoresMax) = Program.acpi.GetCores(true);
if (eCores < 0 || pCores < 0 || eCoresMax < 0 || pCoresMax < 0)
{
panelCores.Visible = false;
return;
}
eCoresMax = Math.Max(8, eCoresMax);
pCoresMax = Math.Max(6, pCoresMax);
panelCores.Visible = true;
comboCoresE.DropDownStyle = ComboBoxStyle.DropDownList;
comboCoresP.DropDownStyle = ComboBoxStyle.DropDownList;
for (int i = AsusACPI.PCoreMin; i <= pCoresMax; i++) comboCoresP.Items.Add(i.ToString() + " Pcores");
for (int i = AsusACPI.ECoreMin; i <= eCoresMax; i++) comboCoresE.Items.Add(i.ToString() + " Ecores");
comboCoresP.SelectedIndex = Math.Max(Math.Min(pCores - AsusACPI.PCoreMin, comboCoresP.Items.Count - 1), 0);
comboCoresE.SelectedIndex = Math.Max(Math.Min(eCores - AsusACPI.ECoreMin, comboCoresE.Items.Count - 1), 0);
buttonCores.Click += ButtonCores_Click;
}
private void ButtonCores_Click(object? sender, EventArgs e)
{
DialogResult dialogResult = MessageBox.Show(Properties.Strings.AlertAPUMemoryRestart, Properties.Strings.AlertAPUMemoryRestartTitle, MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
Program.acpi.SetCores(AsusACPI.ECoreMin + comboCoresE.SelectedIndex, AsusACPI.PCoreMin + comboCoresP.SelectedIndex);
Process.Start("shutdown", "/r /t 1");
}
}
private void PictureScan_Click(object? sender, EventArgs e)
{
string logFile = Program.acpi.ScanRange();

View File

@@ -9,7 +9,7 @@ namespace GHelper.Fan
public const int XGM_FAN_MAX = 72;
public const int INADEQUATE_MAX = 92;
public const int INADEQUATE_MAX = 104;
const int FAN_COUNT = 3;

73
app/Fans.Designer.cs generated
View File

@@ -119,6 +119,10 @@ namespace GHelper
picturePowerMode = new PictureBox();
labelPowerModeTitle = new Label();
panelGPU = new Panel();
panelGPUPower = new Panel();
labelGPUPower = new Label();
labelGPUPowerTitle = new Label();
trackGPUPower = new TrackBar();
panelGPUTemp = new Panel();
labelGPUTemp = new Label();
labelGPUTempTitle = new Label();
@@ -190,6 +194,8 @@ namespace GHelper
panelPowerModeTItle.SuspendLayout();
((System.ComponentModel.ISupportInitialize)picturePowerMode).BeginInit();
panelGPU.SuspendLayout();
panelGPUPower.SuspendLayout();
((System.ComponentModel.ISupportInitialize)trackGPUPower).BeginInit();
panelGPUTemp.SuspendLayout();
((System.ComponentModel.ISupportInitialize)trackGPUTemp).BeginInit();
panelGPUBoost.SuspendLayout();
@@ -533,7 +539,7 @@ namespace GHelper
panelAdvanced.Controls.Add(panelTitleTemp);
panelAdvanced.Controls.Add(panelDownload);
panelAdvanced.Dock = DockStyle.Top;
panelAdvanced.Location = new Point(10, 1644);
panelAdvanced.Location = new Point(10, 1768);
panelAdvanced.Name = "panelAdvanced";
panelAdvanced.Size = new Size(520, 992);
panelAdvanced.TabIndex = 14;
@@ -864,7 +870,7 @@ namespace GHelper
panelPower.Controls.Add(panelPowerMode);
panelPower.Controls.Add(panelPowerModeTItle);
panelPower.Dock = DockStyle.Top;
panelPower.Location = new Point(10, 764);
panelPower.Location = new Point(10, 888);
panelPower.Margin = new Padding(4);
panelPower.Name = "panelPower";
panelPower.Size = new Size(520, 880);
@@ -1237,6 +1243,7 @@ namespace GHelper
panelGPU.AutoSize = true;
panelGPU.Controls.Add(panelGPUTemp);
panelGPU.Controls.Add(panelGPUBoost);
panelGPU.Controls.Add(panelGPUPower);
panelGPU.Controls.Add(panelGPUMemory);
panelGPU.Controls.Add(panelGPUCore);
panelGPU.Controls.Add(panelGPUClockLimit);
@@ -1246,10 +1253,59 @@ namespace GHelper
panelGPU.Margin = new Padding(4);
panelGPU.Name = "panelGPU";
panelGPU.Padding = new Padding(0, 0, 0, 18);
panelGPU.Size = new Size(520, 698);
panelGPU.Size = new Size(520, 822);
panelGPU.TabIndex = 44;
panelGPU.Visible = false;
//
// panelGPUPower
//
panelGPUPower.AutoSize = true;
panelGPUPower.AutoSizeMode = AutoSizeMode.GrowAndShrink;
panelGPUPower.Controls.Add(labelGPUPower);
panelGPUPower.Controls.Add(labelGPUPowerTitle);
panelGPUPower.Controls.Add(trackGPUPower);
panelGPUPower.Dock = DockStyle.Top;
panelGPUPower.Location = new Point(0, 432);
panelGPUPower.Margin = new Padding(4);
panelGPUPower.MaximumSize = new Size(0, 124);
panelGPUPower.Name = "panelGPUPower";
panelGPUPower.Size = new Size(520, 124);
panelGPUPower.TabIndex = 49;
//
// labelGPUPower
//
labelGPUPower.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelGPUPower.Location = new Point(374, 14);
labelGPUPower.Margin = new Padding(4, 0, 4, 0);
labelGPUPower.Name = "labelGPUPower";
labelGPUPower.Size = new Size(124, 32);
labelGPUPower.TabIndex = 44;
labelGPUPower.Text = "105W";
labelGPUPower.TextAlign = ContentAlignment.TopRight;
//
// labelGPUPowerTitle
//
labelGPUPowerTitle.AutoSize = true;
labelGPUPowerTitle.Location = new Point(10, 14);
labelGPUPowerTitle.Margin = new Padding(4, 0, 4, 0);
labelGPUPowerTitle.Name = "labelGPUPowerTitle";
labelGPUPowerTitle.Size = new Size(130, 32);
labelGPUPowerTitle.TabIndex = 43;
labelGPUPowerTitle.Text = "GPU Power";
//
// trackGPUPower
//
trackGPUPower.Location = new Point(6, 48);
trackGPUPower.Margin = new Padding(4, 2, 4, 2);
trackGPUPower.Maximum = 25;
trackGPUPower.Minimum = 5;
trackGPUPower.Name = "trackGPUPower";
trackGPUPower.Size = new Size(496, 90);
trackGPUPower.TabIndex = 42;
trackGPUPower.TickFrequency = 5;
trackGPUPower.TickStyle = TickStyle.TopLeft;
trackGPUPower.Value = 25;
//
// panelGPUTemp
//
panelGPUTemp.AutoSize = true;
@@ -1258,7 +1314,7 @@ namespace GHelper
panelGPUTemp.Controls.Add(labelGPUTempTitle);
panelGPUTemp.Controls.Add(trackGPUTemp);
panelGPUTemp.Dock = DockStyle.Top;
panelGPUTemp.Location = new Point(0, 556);
panelGPUTemp.Location = new Point(0, 680);
panelGPUTemp.Margin = new Padding(4);
panelGPUTemp.MaximumSize = new Size(0, 124);
panelGPUTemp.Name = "panelGPUTemp";
@@ -1307,7 +1363,7 @@ namespace GHelper
panelGPUBoost.Controls.Add(labelGPUBoostTitle);
panelGPUBoost.Controls.Add(trackGPUBoost);
panelGPUBoost.Dock = DockStyle.Top;
panelGPUBoost.Location = new Point(0, 432);
panelGPUBoost.Location = new Point(0, 556);
panelGPUBoost.Margin = new Padding(4);
panelGPUBoost.MaximumSize = new Size(0, 124);
panelGPUBoost.Name = "panelGPUBoost";
@@ -1700,6 +1756,9 @@ namespace GHelper
((System.ComponentModel.ISupportInitialize)picturePowerMode).EndInit();
panelGPU.ResumeLayout(false);
panelGPU.PerformLayout();
panelGPUPower.ResumeLayout(false);
panelGPUPower.PerformLayout();
((System.ComponentModel.ISupportInitialize)trackGPUPower).EndInit();
panelGPUTemp.ResumeLayout(false);
panelGPUTemp.PerformLayout();
((System.ComponentModel.ISupportInitialize)trackGPUTemp).EndInit();
@@ -1833,5 +1892,9 @@ namespace GHelper
private TrackBar trackSlow;
private Panel panelDownload;
private RButton buttonDownload;
private Panel panelGPUPower;
private Label labelGPUPower;
private Label labelGPUPowerTitle;
private TrackBar trackGPUPower;
}
}

View File

@@ -31,6 +31,8 @@ namespace GHelper
FanSensorControl fanSensorControl;
static int gpuPowerBase = 0;
public Fans()
{
@@ -144,17 +146,22 @@ namespace GHelper
trackGPUTemp.Minimum = AsusACPI.MinGPUTemp;
trackGPUTemp.Maximum = AsusACPI.MaxGPUTemp;
trackGPUPower.Minimum = AsusACPI.MinGPUPower;
trackGPUPower.Maximum = AsusACPI.MaxGPUPower;
trackGPUClockLimit.Scroll += trackGPUClockLimit_Scroll;
trackGPUCore.Scroll += trackGPU_Scroll;
trackGPUMemory.Scroll += trackGPU_Scroll;
trackGPUBoost.Scroll += trackGPUPower_Scroll;
trackGPUTemp.Scroll += trackGPUPower_Scroll;
trackGPUPower.Scroll += trackGPUPower_Scroll;
trackGPUCore.MouseUp += TrackGPU_MouseUp;
trackGPUMemory.MouseUp += TrackGPU_MouseUp;
trackGPUBoost.MouseUp += TrackGPU_MouseUp;
trackGPUTemp.MouseUp += TrackGPU_MouseUp;
trackGPUPower.MouseUp += TrackGPU_MouseUp;
trackGPUClockLimit.MouseUp += TrackGPU_MouseUp;
@@ -541,8 +548,12 @@ namespace GHelper
{
gpuVisible = buttonGPU.Visible = true;
gpuPowerBase = Program.acpi.DeviceGet(AsusACPI.GPU_BASE);
int gpuPowerVar = Program.acpi.DeviceGet(AsusACPI.GPU_POWER);
int gpu_boost = AppConfig.GetMode("gpu_boost");
int gpu_temp = AppConfig.GetMode("gpu_temp");
int gpu_power = AppConfig.GetMode("gpu_power");
int core = AppConfig.GetMode("gpu_core");
int memory = AppConfig.GetMode("gpu_memory");
@@ -550,32 +561,35 @@ namespace GHelper
if (gpu_boost < 0) gpu_boost = AsusACPI.MaxGPUBoost;
if (gpu_temp < 0) gpu_temp = AsusACPI.MaxGPUTemp;
if (gpu_power < 0) gpu_power = (gpuPowerVar >= 0) ? gpuPowerVar : AsusACPI.MaxGPUPower;
if (core == -1) core = 0;
if (memory == -1) memory = 0;
if (clock_limit == -1) clock_limit = NvidiaGpuControl.MaxClockLimit;
if (nvControl.GetClocks(out int current_core, out int current_memory))
if (nvControl is not null)
{
core = current_core;
memory = current_memory;
if (nvControl.GetClocks(out int current_core, out int current_memory))
{
core = current_core;
memory = current_memory;
}
int _clockLimit = nvControl.GetMaxGPUCLock();
if (_clockLimit == 0) clock_limit = NvidiaGpuControl.MaxClockLimit;
else if (_clockLimit > 0) clock_limit = _clockLimit;
try
{
labelGPU.Text = nvControl.FullName;
}
catch
{
}
}
int _clockLimit = nvControl.GetMaxGPUCLock();
if (_clockLimit == 0) clock_limit = NvidiaGpuControl.MaxClockLimit;
else if (_clockLimit > 0) clock_limit = _clockLimit;
try
{
labelGPU.Text = nvControl.FullName;
}
catch
{
}
//}
trackGPUClockLimit.Value = Math.Max(Math.Min(clock_limit, NvidiaGpuControl.MaxClockLimit), NvidiaGpuControl.MinClockLimit);
trackGPUCore.Value = Math.Max(Math.Min(core, NvidiaGpuControl.MaxCoreOffset), NvidiaGpuControl.MinCoreOffset);
@@ -584,9 +598,13 @@ namespace GHelper
trackGPUBoost.Value = Math.Max(Math.Min(gpu_boost, AsusACPI.MaxGPUBoost), AsusACPI.MinGPUBoost);
trackGPUTemp.Value = Math.Max(Math.Min(gpu_temp, AsusACPI.MaxGPUTemp), AsusACPI.MinGPUTemp);
trackGPUPower.Value = Math.Max(Math.Min(gpu_power, AsusACPI.MaxGPUPower), AsusACPI.MinGPUPower);
panelGPUBoost.Visible = (Program.acpi.DeviceGet(AsusACPI.PPT_GPUC0) >= 0);
panelGPUTemp.Visible = (Program.acpi.DeviceGet(AsusACPI.PPT_GPUC2) >= 0);
panelGPUPower.Visible = gpuPowerBase > 0 && gpuPowerVar >= 0;
VisualiseGPUSettings();
}
@@ -610,6 +628,9 @@ namespace GHelper
labelGPUClockLimit.Text = "Default";
else
labelGPUClockLimit.Text = $"{trackGPUClockLimit.Value} MHz";
labelGPUPower.Text = (gpuPowerBase + trackGPUPower.Value) + "W";
}
private void trackGPUClockLimit_Scroll(object? sender, EventArgs e)
@@ -640,6 +661,7 @@ namespace GHelper
{
AppConfig.SetMode("gpu_boost", trackGPUBoost.Value);
AppConfig.SetMode("gpu_temp", trackGPUTemp.Value);
AppConfig.SetMode("gpu_power", trackGPUPower.Value);
VisualiseGPUSettings();
}
@@ -740,7 +762,10 @@ namespace GHelper
private void TrackPower_MouseUp(object? sender, MouseEventArgs e)
{
modeControl.AutoPower();
Task.Run(() =>
{
modeControl.AutoPower(true);
});
}
@@ -1089,19 +1114,24 @@ namespace GHelper
if (gpuVisible)
{
int gpuPowerVar = Program.acpi.DeviceGet(AsusACPI.GPU_POWER);
trackGPUClockLimit.Value = NvidiaGpuControl.MaxClockLimit;
trackGPUCore.Value = 0;
trackGPUMemory.Value = 0;
trackGPUBoost.Value = AsusACPI.MaxGPUBoost;
trackGPUTemp.Value = AsusACPI.MaxGPUTemp;
AppConfig.SetMode("gpu_clock_limit", trackGPUClockLimit.Value);
trackGPUPower.Value = (gpuPowerVar >= 0) ? gpuPowerVar : AsusACPI.MaxGPUPower;
AppConfig.SetMode("gpu_boost", trackGPUBoost.Value);
AppConfig.SetMode("gpu_temp", trackGPUTemp.Value);
AppConfig.SetMode("gpu_core", trackGPUCore.Value);
AppConfig.SetMode("gpu_memory", trackGPUMemory.Value);
AppConfig.RemoveMode("gpu_power");
AppConfig.RemoveMode("gpu_clock_limit");
AppConfig.RemoveMode("gpu_core");
AppConfig.RemoveMode("gpu_memory");
VisualiseGPUSettings();
modeControl.SetGPUClocks(true);

View File

@@ -15,7 +15,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyVersion>0.154</AssemblyVersion>
<AssemblyVersion>0.156</AssemblyVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -88,6 +88,14 @@
</Content>
</ItemGroup>
<ItemGroup>
<Reference Include="RTSSSharedMemoryNET">
<HintPath>RTSSSharedMemoryNET.dll</HintPath>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>

View File

@@ -14,18 +14,24 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Debug|Any CPU.ActiveCfg = Debug|x64
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Debug|Any CPU.Build.0 = Debug|x64
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Debug|x64.ActiveCfg = Debug|Any CPU
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Debug|x64.Build.0 = Debug|Any CPU
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Debug|x86.ActiveCfg = Debug|Any CPU
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Debug|x86.Build.0 = Debug|Any CPU
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Release|Any CPU.ActiveCfg = Release|x64
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Release|Any CPU.Build.0 = Release|x64
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Release|x64.ActiveCfg = Release|x64
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Release|x64.Build.0 = Release|x64
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Release|x86.ActiveCfg = Release|Any CPU
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -101,6 +101,8 @@ namespace GHelper.Helpers
if (Program.settingsForm.Visible)
Program.screenControl.InitScreen();
Program.screenControl.SetBrightness();
}
private static int CheckAndSaveLidAction()

View File

@@ -890,6 +890,7 @@ namespace GHelper.Input
if (e.NewEvent is null) return;
int EventID = int.Parse(e.NewEvent["EventID"].ToString());
Logger.WriteLine("WMI event " + EventID);
if (AppConfig.NoWMI()) return;
HandleEvent(EventID);
}
}

View File

@@ -87,8 +87,15 @@ namespace GHelper.Mode
Program.toast.RunToast(Modes.GetCurrentName(), SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online ? ToastIcon.Charger : ToastIcon.Battery);
SetGPUClocks();
AutoFans();
AutoPower(1000);
Task.Run(async () =>
{
await Task.Delay(TimeSpan.FromMilliseconds(100));
AutoFans();
await Task.Delay(TimeSpan.FromMilliseconds(1000));
AutoPower();
});
// Power plan from config or defaulting to balanced
if (AppConfig.GetModeString("scheme") is not null)
@@ -145,18 +152,17 @@ namespace GHelper.Mode
Program.acpi.SetFanCurve(AsusFan.Mid, AppConfig.GetFanConfig(AsusFan.Mid));
// something went wrong, resetting to default profile
// Alternative way to set fan curve
if (cpuResult != 1 || gpuResult != 1)
{
cpuResult = Program.acpi.SetFanRange(AsusFan.CPU, AppConfig.GetFanConfig(AsusFan.CPU));
gpuResult = Program.acpi.SetFanRange(AsusFan.GPU, AppConfig.GetFanConfig(AsusFan.GPU));
// Something went wrong, resetting to default profile
if (cpuResult != 1 || gpuResult != 1)
{
int mode = Modes.GetCurrentBase();
Logger.WriteLine("ASUS BIOS rejected fan curve, resetting mode to " + mode);
Program.acpi.DeviceSet(AsusACPI.PerformanceMode, mode, "Reset Mode");
settings.LabelFansResult("ASUS BIOS rejected fan curve");
Program.acpi.DeviceSet(AsusACPI.PerformanceMode, Modes.GetCurrentBase(), "Reset Mode");
settings.LabelFansResult("Model doesn't support custom fan curves");
}
}
else
@@ -182,52 +188,25 @@ namespace GHelper.Mode
}
public void AutoPower(int delay = 0)
public void AutoPower(bool launchAsAdmin = false)
{
customPower = 0;
bool applyPower = AppConfig.IsMode("auto_apply_power");
bool applyFans = AppConfig.IsMode("auto_apply");
//bool applyGPU = true;
if (applyPower && !applyFans)
if (applyPower && !applyFans && (AppConfig.IsFanRequired() || AppConfig.IsManualModeRequired()))
{
// force fan curve for misbehaving bios PPTs on some models
if (AppConfig.IsFanRequired())
{
delay = 500;
AutoFans(true);
}
// Fix for models that don't support PPT settings in all modes, setting a "manual" mode for them
if (AppConfig.IsManualModeRequired())
{
AutoFans(true);
}
AutoFans(true);
Thread.Sleep(500);
}
if (delay > 0)
{
var timer = new System.Timers.Timer(delay);
timer.Elapsed += delegate
{
timer.Stop();
timer.Dispose();
if (applyPower) SetPower(launchAsAdmin);
if (applyPower) SetPower();
Thread.Sleep(500);
SetGPUPower();
AutoRyzen();
};
timer.Start();
}
else
{
if (applyPower) SetPower(true);
SetGPUPower();
AutoRyzen();
}
Thread.Sleep(500);
SetGPUPower();
AutoRyzen();
}
@@ -346,18 +325,20 @@ namespace GHelper.Mode
int gpu_boost = AppConfig.GetMode("gpu_boost");
int gpu_temp = AppConfig.GetMode("gpu_temp");
int gpu_power = AppConfig.GetMode("gpu_power");
int boostResult = -1;
if (gpu_boost < AsusACPI.MinGPUBoost || gpu_boost > AsusACPI.MaxGPUBoost) return;
if (gpu_temp < AsusACPI.MinGPUTemp || gpu_temp > AsusACPI.MaxGPUTemp) return;
if (gpu_power >= AsusACPI.MinGPUPower && gpu_power <= AsusACPI.MaxGPUPower && Program.acpi.DeviceGet(AsusACPI.GPU_POWER) >= 0)
Program.acpi.DeviceSet(AsusACPI.GPU_POWER, gpu_power, "PowerLimit TGP (GPU VAR)");
if (Program.acpi.DeviceGet(AsusACPI.PPT_GPUC0) >= 0)
boostResult = Program.acpi.DeviceSet(AsusACPI.PPT_GPUC0, gpu_boost, "PowerLimit C0");
if (gpu_boost >= AsusACPI.MinGPUBoost && gpu_boost <= AsusACPI.MaxGPUBoost && Program.acpi.DeviceGet(AsusACPI.PPT_GPUC0) >= 0)
boostResult = Program.acpi.DeviceSet(AsusACPI.PPT_GPUC0, gpu_boost, "PowerLimit C0 (GPU BOOST)");
if (Program.acpi.DeviceGet(AsusACPI.PPT_GPUC2) >= 0)
Program.acpi.DeviceSet(AsusACPI.PPT_GPUC2, gpu_temp, "PowerLimit C2");
if (gpu_temp >= AsusACPI.MinGPUTemp && gpu_temp <= AsusACPI.MaxGPUTemp && Program.acpi.DeviceGet(AsusACPI.PPT_GPUC2) >= 0)
Program.acpi.DeviceSet(AsusACPI.PPT_GPUC2, gpu_temp, "PowerLimit C2 (GPU TEMP)");
// Fallback
if (boostResult == 0)
Program.acpi.DeviceSet(AsusACPI.PPT_GPUC0, gpu_boost, "PowerLimit C0");

View File

@@ -163,7 +163,7 @@ namespace GHelper.Mode
if (status != 0 || activeScheme != guidScheme)
{
status = PowerSetActiveOverlayScheme(guidScheme);
Logger.WriteLine("Power Mode " + scheme + ":" + (status == 0 ? "OK" : status));
Logger.WriteLine("Power Mode " + activeScheme + " -> " + scheme + ":" + (status == 0 ? "OK" : status));
}
}

View File

@@ -0,0 +1,247 @@
namespace GHelper.Peripherals.Mouse.Models
{
//P303
public class StrixImpact : AsusMouse
{
public StrixImpact() : base(0x0B05, 0x1847, "mi_02", false)
{
}
public StrixImpact(ushort productId, string path) : base(0x0B05, productId, path, false)
{
}
public override int DPIProfileCount()
{
return 2;
}
public override string GetDisplayName()
{
return "Strix Impact";
}
public override PollingRate[] SupportedPollingrates()
{
return new PollingRate[] {
PollingRate.PR125Hz,
PollingRate.PR250Hz,
PollingRate.PR500Hz,
PollingRate.PR1000Hz
};
}
public override int ProfileCount()
{
return 1;
}
public override int MaxDPI()
{
return 5_000;
}
public override bool HasRGB()
{
return true;
}
public override bool HasAutoPowerOff()
{
return false;
}
public override bool HasDebounceSetting()
{
return true;
}
public override bool HasLowBatteryWarning()
{
return false;
}
public override bool HasBattery()
{
return false;
}
public override bool HasDPIColors()
{
return false;
}
public override bool IsLightingModeSupported(LightingMode lightingMode)
{
return lightingMode == LightingMode.Static
|| lightingMode == LightingMode.Breathing
|| lightingMode == LightingMode.ColorCycle
|| lightingMode == LightingMode.React;
}
public override LightingZone[] SupportedLightingZones()
{
return new LightingZone[] { LightingZone.Logo };
}
public override int DPIIncrements()
{
return 100;
}
public override int MinDPI()
{
return 200;
}
public override bool CanChangeDPIProfile()
{
return true;
}
public override int MaxBrightness()
{
return 4;
}
protected override byte[] GetUpdateLightingModePacket(LightingSetting lightingSetting, LightingZone zone)
{
/*
* 51 28 00 00 [00] [04] [35 04 FF] 00 00 00 00 00 00 00
*/
return new byte[] { reportId, 0x51, 0x28, 0x00, 0x00,
IndexForLightingMode(lightingSetting.LightingMode),
(byte)lightingSetting.Brightness,
lightingSetting.RGBColor.R, lightingSetting.RGBColor.G, lightingSetting.RGBColor.B
};
}
protected override byte[] GetReadLightingModePacket(LightingZone zone)
{
return new byte[] { 0x00, 0x12, 0x03, 0x00 };
}
protected LightingSetting? ParseLightingSetting(byte[] packet, LightingZone zone)
{
if (packet[1] != 0x12 || packet[2] != 0x03)
{
return null;
}
int offset = 5 + (((int)zone) * 5);
LightingSetting setting = new LightingSetting();
setting.LightingMode = LightingModeForIndex(packet[offset + 0]);
setting.Brightness = packet[offset + 1];
setting.RGBColor = Color.FromArgb(packet[offset + 2], packet[offset + 3], packet[offset + 4]);
return setting;
}
public override void ReadLightingSetting()
{
if (!HasRGB())
{
return;
}
//Mouse sends all lighting zones in one response Direction, Random col, Speed
//00 12 03 00 00 [00 04 ff 00 80] [00 04 00 ff ff] [00 04 ff ff ff] 00 [00] [00] [00] 00 00
//00 12 03 00 00 [03 04 00 00 00] [03 04 00 00 00] [03 04 00 00 00] 00 [00] [00] [07] 00 00
byte[]? response = WriteForResponse(GetReadLightingModePacket(LightingZone.All));
if (response is null) return;
LightingZone[] lz = SupportedLightingZones();
for (int i = 0; i < lz.Length; ++i)
{
LightingSetting? ls = ParseLightingSetting(response, lz[i]);
if (ls is null)
{
Logger.WriteLine(GetDisplayName() + ": Failed to read RGB Setting for Zone " + lz[i].ToString());
continue;
}
ls.AnimationDirection = SupportsAnimationDirection(ls.LightingMode)
? (AnimationDirection)response[21]
: AnimationDirection.Clockwise;
ls.RandomColor = SupportsRandomColor(ls.LightingMode) && response[22] == 0x01;
ls.AnimationSpeed = SupportsAnimationSpeed(ls.LightingMode)
? (AnimationSpeed)response[23]
: AnimationSpeed.Medium;
if (ls.AnimationSpeed != AnimationSpeed.Fast
&& ls.AnimationSpeed != AnimationSpeed.Medium
&& ls.AnimationSpeed != AnimationSpeed.Slow)
{
ls.AnimationSpeed = AnimationSpeed.Medium;
}
Logger.WriteLine(GetDisplayName() + ": Read RGB Setting for Zone " + lz[i].ToString() + ": " + ls.ToString());
LightingSetting[i] = ls;
}
}
protected override PollingRate ParsePollingRate(byte[] packet)
{
if (packet[1] == 0x12 && packet[2] == 0x04 && packet[3] == 0x00)
{
return (PollingRate)packet[9];
}
return PollingRate.PR125Hz;
}
protected override byte[] GetUpdatePollingRatePacket(PollingRate pollingRate)
{
return new byte[] { reportId, 0x51, 0x31, 0x02, 0x00, (byte)pollingRate };
}
protected override bool ParseAngleSnapping(byte[] packet)
{
if (packet[1] == 0x12 && packet[2] == 0x04 && packet[3] == 0x00)
{
return packet[13] == 0x01;
}
return false;
}
protected override byte[] GetUpdateAngleSnappingPacket(bool angleSnapping)
{
return new byte[] { reportId, 0x51, 0x31, 0x04, 0x00, (byte)(angleSnapping ? 0x01 : 0x00) };
}
protected override DebounceTime ParseDebounce(byte[] packet)
{
if (packet[1] != 0x12 || packet[2] != 0x04 || packet[3] != 0x00)
{
return DebounceTime.MS12;
}
if (packet[11] < 0x02)
{
return DebounceTime.MS12;
}
if (packet[11] > 0x07)
{
return DebounceTime.MS32;
}
return (DebounceTime)packet[11];
}
protected override byte[] GetUpdateDebouncePacket(DebounceTime debounce)
{
return new byte[] { reportId, 0x51, 0x31, 0x03, 0x00, ((byte)debounce) };
}
}
}

View File

@@ -215,6 +215,7 @@ namespace GHelper.Peripherals
DetectMouse(new SpathaX());
DetectMouse(new StrixCarry());
DetectMouse(new StrixImpactIII());
DetectMouse(new StrixImpact());
}
public static void DetectMouse(AsusMouse am)

View File

@@ -1,4 +1,5 @@
using GHelper.Ally;
using GHelper.AutoTDP;
using GHelper.Battery;
using GHelper.Display;
using GHelper.Gpu;
@@ -46,6 +47,8 @@ namespace GHelper
private static PowerLineStatus isPlugged = SystemInformation.PowerStatus.PowerLineStatus;
public static AutoTDPService autoTDPService = new AutoTDPService();
// The main entry point for the application
public static void Main(string[] args)
{
@@ -306,6 +309,7 @@ namespace GHelper
static void OnExit(object sender, EventArgs e)
{
autoTDPService.Shutdown();
trayIcon.Visible = false;
PeripheralsProvider.UnregisterForDeviceEvents();
clamshellControl.UnregisterDisplayEvents();

View File

@@ -600,6 +600,16 @@ namespace GHelper.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_search_32 {
get {
object obj = ResourceManager.GetObject("icons8-search-32", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@@ -136,9 +136,6 @@
<data name="icons8-bicycle-48 (1)" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-bicycle-48 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="standard" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="eco" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\eco.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@@ -166,9 +163,6 @@
<data name="icons8-automation-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-automation-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-settings-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-settings-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="brightness_up" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\brightness-up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@@ -178,8 +172,8 @@
<data name="icons8_processor_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-processor-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-fiat-500-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-fiat-500-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="MFont" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Font.otf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="icons8_touchpad_96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-touchpad-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -199,6 +193,9 @@
<data name="icons8_remove_64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-remove-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_share_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-share-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_function" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-function-mac-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@@ -217,6 +214,9 @@
<data name="backlight" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\backlight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-brightness-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-brightness-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-refresh-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-refresh-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@@ -232,11 +232,14 @@
<data name="icons8-xbox-rt-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-xbox-rt-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_controller_96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-controller-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-fan-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-fan-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_controller_96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-controller-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="icons8-settings-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-settings-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_maus_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-maus-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -286,8 +289,8 @@
<data name="icons8_video_48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-video-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="MFont" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Font.otf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="icons8-fiat-500-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-fiat-500-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="dot_eco" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\dot-eco.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -322,8 +325,8 @@
<data name="icons8_software_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-software-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_share_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-share-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="standard" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-soonvibes-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-soonvibes-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -334,7 +337,7 @@
<data name="icons8-charging-battery-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-charging-battery-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-brightness-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-brightness-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="icons8-search-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-search-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -699,6 +699,15 @@ namespace GHelper.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Disable on lid close.
/// </summary>
internal static string DisableOnLidClose {
get {
return ResourceManager.GetString("DisableOnLidClose", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Disable screen overdrive.
/// </summary>
@@ -790,9 +799,9 @@ namespace GHelper.Properties {
return ResourceManager.GetString("EnergySettings", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Export.
/// Looks up a localized string similar to Export Profile.
/// </summary>
internal static string Export {
get {
@@ -1024,9 +1033,9 @@ namespace GHelper.Properties {
return ResourceManager.GetString("ImageRotation", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Import.
/// Looks up a localized string similar to Import Profile.
/// </summary>
internal static string Import {
get {
@@ -1294,9 +1303,9 @@ namespace GHelper.Properties {
return ResourceManager.GetString("MouseButtonResponse", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Import failed. Selected file is not a valid mouse profile or corrutpted.
/// Looks up a localized string similar to Import failed. Selected file is not a valid mouse profile or corrutpted..
/// </summary>
internal static string MouseImportFailed {
get {
@@ -1800,7 +1809,7 @@ namespace GHelper.Properties {
}
/// <summary>
/// Looks up a localized string similar to Turn off on battery.
/// Looks up a localized string similar to Disable on battery.
/// </summary>
internal static string TurnOffOnBattery {
get {

View File

@@ -124,10 +124,10 @@
<value>Verbindung zu ASUS ACPI fehlgeschlagen. G-Helper kann nicht ausgeführt werden. Bitte installiere ASUS System Control Interface.</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Restart your device to apply changes</value>
<value>Gerät neu starten, um Änderungen anzuwenden</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Restart now?</value>
<value>Jetzt neu starten?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>Die GPU wird gerade verwendet. Trotzdem deaktivieren?</value>
@@ -250,7 +250,7 @@
<value>Im Betrieb</value>
</data>
<data name="BacklightTimeout" xml:space="preserve">
<value>Timeout angeschlossen / bei Akku (0 - AN)</value>
<value>Timeout angeschlossen / bei Akku (0 = An)</value>
</data>
<data name="BacklightTimeoutBattery" xml:space="preserve">
<value>Backlight Timeout when on battery</value>
@@ -289,7 +289,7 @@
<value>Hochfahren</value>
</data>
<data name="BootSound" xml:space="preserve">
<value>Boot Sound</value>
<value>Boot-Sound</value>
</data>
<data name="Brightness" xml:space="preserve">
<value>Helligkeit</value>
@@ -310,7 +310,7 @@
<value>Farbe</value>
</data>
<data name="Contrast" xml:space="preserve">
<value>Contrast</value>
<value>Kontrast</value>
</data>
<data name="Controller" xml:space="preserve">
<value>Controller</value>
@@ -328,7 +328,10 @@
<value>Standard</value>
</data>
<data name="DisableController" xml:space="preserve">
<value>Disable Controller</value>
<value>Controller deaktivieren</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Disable on lid close</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>Bildschirm: Overdrive abschalten</value>
@@ -349,7 +352,7 @@
<value>Eco</value>
</data>
<data name="EnableGPUOnShutdown" xml:space="preserve">
<value>Enable GPU on shutdown (prevents issue with Eco mode)</value>
<value>Aktiviere GPU beim Herunterfahren (verhindert Problem im Eco-Modus)</value>
</data>
<data name="EnableOptimusText" xml:space="preserve">
<value>Die dGPU zu deaktivieren, indem Sie in den Eco-Modus wechseln während der Anzeigemodus nicht auf Optimus eingestellt ist, kann zu Problemen mit der Helligkeitseinstellung führen.
@@ -363,7 +366,7 @@ Trotzdem fortfahren?</value>
<value>Energieeinstellungen</value>
</data>
<data name="Export" xml:space="preserve">
<value>Export Profile</value>
<value>Profil exportieren</value>
</data>
<data name="Extra" xml:space="preserve">
<value>Extra</value>
@@ -438,10 +441,10 @@ Trotzdem fortfahren?</value>
<value>Hoch</value>
</data>
<data name="ImageRotation" xml:space="preserve">
<value>Image Rotation</value>
<value>Bilddrehung</value>
</data>
<data name="Import" xml:space="preserve">
<value>Import Profile</value>
<value>Profil importieren</value>
</data>
<data name="KeyBindings" xml:space="preserve">
<value>Tastenbelegung</value>
@@ -531,7 +534,7 @@ Trotzdem fortfahren?</value>
<value>Tastenreaktionsgeschwindigkeit</value>
</data>
<data name="MouseImportFailed" xml:space="preserve">
<value>Import failed. Selected file is not a valid mouse profile or corrutpted.</value>
<value>Import fehlgeschlagen. Die ausgewählte Datei ist kein gültiges Mausprofil oder beschädigt.</value>
</data>
<data name="MouseLiftOffDistance" xml:space="preserve">
<value>Lift Off Distance</value>
@@ -618,7 +621,7 @@ Trotzdem fortfahren?</value>
<value>Schließen</value>
</data>
<data name="Reset" xml:space="preserve">
<value>Reset</value>
<value>Zurücksetzen</value>
</data>
<data name="RestartGPU" xml:space="preserve">
<value>Ein Prozess verhindert den Wechsel in den Eco-Modus. dGPU neu starten? Fortfahren auf eigene Gefahr.</value>
@@ -636,7 +639,7 @@ Trotzdem fortfahren?</value>
<value>Beim Start ausführen</value>
</data>
<data name="ScalingQuality" xml:space="preserve">
<value>Scaling Quality</value>
<value>Skalierungsqualität</value>
</data>
<data name="ScreenPadDown" xml:space="preserve">
<value>Screenpad Helligkeit verringern</value>
@@ -717,7 +720,7 @@ Trotzdem fortfahren?</value>
<value>Version</value>
</data>
<data name="VibrationStrength" xml:space="preserve">
<value>Vibration Strength</value>
<value>Vibrationsstärke</value>
</data>
<data name="VolumeDown" xml:space="preserve">
<value>Lautstärke verringern</value>

View File

@@ -330,6 +330,9 @@
<data name="DisableController" xml:space="preserve">
<value>Deshabilitar mando</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Desactivar al cerrar la tapa</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>Desactivar Overdrive</value>
</data>

View File

@@ -330,6 +330,9 @@
<data name="DisableController" xml:space="preserve">
<value>Désactiver le contrôleur</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Disable on lid close</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>Désactiver l'overdrive de l'écran</value>
</data>
@@ -456,10 +459,10 @@ Voulez-vous continuer ?</value>
<value>Rétroéclairage du clavier</value>
</data>
<data name="LaptopKeyboard" xml:space="preserve">
<value>Clavier de l'ordinateur</value>
<value>Clavier</value>
</data>
<data name="LaptopScreen" xml:space="preserve">
<value>Écran de l'ordinateur </value>
<value>Écran</value>
</data>
<data name="Lid" xml:space="preserve">
<value>Capot</value>
@@ -588,7 +591,7 @@ Voulez-vous continuer ?</value>
<value>Overdrive</value>
</data>
<data name="PerformanceMode" xml:space="preserve">
<value>Mode Performance</value>
<value>Mode</value>
</data>
<data name="Peripherals" xml:space="preserve">
<value>Périphériques</value>

View File

@@ -330,6 +330,9 @@
<data name="DisableController" xml:space="preserve">
<value>Disable Controller</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Disable on lid close</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>Képernyőtúlhajtás letiltása</value>
</data>

View File

@@ -330,6 +330,9 @@
<data name="DisableController" xml:space="preserve">
<value>Disable Controller</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Disable on lid close</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>Nonaktifkan screen overdrive</value>
</data>

View File

@@ -330,6 +330,9 @@
<data name="DisableController" xml:space="preserve">
<value>Disable Controller</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Disable on lid close</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>Disabilita Overdrive Schermo</value>
</data>

View File

@@ -330,6 +330,9 @@
<data name="DisableController" xml:space="preserve">
<value>Disable Controller</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Disable on lid close</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>화면 OD 끄기</value>
</data>

View File

@@ -330,6 +330,9 @@
<data name="DisableController" xml:space="preserve">
<value>Disable Controller</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Disable on lid close</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>Išjungti ekrano pikselių spartinimą</value>
</data>

View File

@@ -330,6 +330,9 @@
<data name="DisableController" xml:space="preserve">
<value>Disable Controller</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Disable on lid close</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>Wyłącz funkcję Overdrive monitora</value>
</data>

View File

@@ -330,6 +330,9 @@
<data name="DisableController" xml:space="preserve">
<value>Disable Controller</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Disable on lid close</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>Desativar o overdrive da tela</value>
</data>

View File

@@ -330,6 +330,9 @@
<data name="DisableController" xml:space="preserve">
<value>Disable Controller</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Disable on lid close</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>Desativar o overdrive do ecrã</value>
</data>

View File

@@ -330,6 +330,9 @@
<data name="DisableController" xml:space="preserve">
<value>Disable Controller</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Disable on lid close</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>Disable screen overdrive</value>
</data>
@@ -699,7 +702,7 @@ Do you still want to continue?</value>
<value>Turned off</value>
</data>
<data name="TurnOffOnBattery" xml:space="preserve">
<value>Turn off on battery</value>
<value>Disable on battery</value>
</data>
<data name="UltimateGPUTooltip" xml:space="preserve">
<value>Routes laptop screen to dGPU, maximizing FPS</value>

View File

@@ -330,6 +330,9 @@
<data name="DisableController" xml:space="preserve">
<value>Disable Controller</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Disable on lid close</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>Dezactivează screen overdrive</value>
</data>

View File

@@ -330,6 +330,9 @@
<data name="DisableController" xml:space="preserve">
<value>Disable Controller</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Disable on lid close</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>Ekran overdrive özelliğini devre dışı bırak</value>
</data>

View File

@@ -330,6 +330,9 @@
<data name="DisableController" xml:space="preserve">
<value>Вимкнути контролер</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Вимкнути при закритті</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>Вимкнути овердрайв дисплею</value>
</data>
@@ -699,7 +702,7 @@
<value>Вимкнений</value>
</data>
<data name="TurnOffOnBattery" xml:space="preserve">
<value>Вимикати на батареї</value>
<value>Вимкнути на батареї</value>
</data>
<data name="UltimateGPUTooltip" xml:space="preserve">
<value>Підключає екран лептопу до dGPU, щоб підвищити FPS</value>

View File

@@ -330,6 +330,9 @@
<data name="DisableController" xml:space="preserve">
<value>Disable Controller</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Disable on lid close</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>Tắt Overdrive</value>
</data>

View File

@@ -330,6 +330,9 @@
<data name="DisableController" xml:space="preserve">
<value>Disable Controller</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Disable on lid close</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>禁用屏幕快速显示(OD)</value>
</data>

View File

@@ -145,7 +145,7 @@
<value>現在重新啟動嗎?</value>
</data>
<data name="AllyController" xml:space="preserve">
<value>Ally Controller</value>
<value>Ally控制器</value>
</data>
<data name="AnimationSpeed" xml:space="preserve">
<value>動畫速度</value>
@@ -277,10 +277,10 @@
<value>Binding</value>
</data>
<data name="BindingPrimary" xml:space="preserve">
<value>Primary</value>
<value>主要</value>
</data>
<data name="BindingSecondary" xml:space="preserve">
<value>Secondary</value>
<value>次要</value>
</data>
<data name="BiosAndDriverUpdates" xml:space="preserve">
<value>BIOS與驅動程式更新</value>
@@ -313,7 +313,7 @@
<value>Contrast</value>
</data>
<data name="Controller" xml:space="preserve">
<value>Controller</value>
<value>控制器</value>
</data>
<data name="CPUBoost" xml:space="preserve">
<value>CPU 加速</value>
@@ -328,7 +328,10 @@
<value>預設</value>
</data>
<data name="DisableController" xml:space="preserve">
<value>Disable Controller</value>
<value>停用控制器</value>
</data>
<data name="DisableOnLidClose" xml:space="preserve">
<value>Disable on lid close</value>
</data>
<data name="DisableOverdrive" xml:space="preserve">
<value>禁用螢幕加速OD</value>
@@ -363,7 +366,7 @@
<value>電源設定</value>
</data>
<data name="Export" xml:space="preserve">
<value>Export Profile</value>
<value>匯出設定檔</value>
</data>
<data name="Extra" xml:space="preserve">
<value>更多</value>
@@ -441,7 +444,7 @@
<value>Image Rotation</value>
</data>
<data name="Import" xml:space="preserve">
<value>Import Profile</value>
<value>匯入設定檔</value>
</data>
<data name="KeyBindings" xml:space="preserve">
<value>按鍵綁定</value>
@@ -531,7 +534,7 @@
<value>按鍵回應</value>
</data>
<data name="MouseImportFailed" xml:space="preserve">
<value>Import failed. Selected file is not a valid mouse profile or corrutpted.</value>
<value>匯入失敗,所選檔案並非有效的滑鼠設定檔或該檔已毀損</value>
</data>
<data name="MouseLiftOffDistance" xml:space="preserve">
<value>響應高度(LOD)</value>
@@ -618,7 +621,7 @@
<value>退出</value>
</data>
<data name="Reset" xml:space="preserve">
<value>Reset</value>
<value>重設</value>
</data>
<data name="RestartGPU" xml:space="preserve">
<value>有其他程式正在使用獨顯導致無法切換至節能模式. 是否讓G-Helper重新啟動獨顯? * 請自行評估風險</value>

BIN
app/RTSSSharedMemoryNET.dll Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 B

124
app/Settings.Designer.cs generated
View File

@@ -31,6 +31,9 @@ namespace GHelper
private void InitializeComponent()
{
panelMatrix = new Panel();
panelMatrixAuto = new Panel();
checkMatrixLid = new CheckBox();
checkMatrix = new CheckBox();
tableLayoutMatrix = new TableLayoutPanel();
comboMatrix = new RComboBox();
comboMatrixRunning = new RComboBox();
@@ -39,7 +42,6 @@ namespace GHelper
panelMatrixTitle = new Panel();
pictureMatrix = new PictureBox();
labelMatrix = new Label();
checkMatrix = new CheckBox();
panelBattery = new Panel();
buttonBatteryFull = new RButton();
sliderBattery = new Slider();
@@ -65,6 +67,8 @@ namespace GHelper
labelCPUFan = new Label();
panelGPU = new Panel();
labelTipGPU = new Label();
tableAdditionalGPUFeature = new TableLayoutPanel();
buttonAutoTDP = new RButton();
tableAMD = new TableLayoutPanel();
buttonOverlay = new RButton();
buttonFPS = new RButton();
@@ -127,6 +131,7 @@ namespace GHelper
pictureGamma = new PictureBox();
labelGammaTitle = new Label();
panelMatrix.SuspendLayout();
panelMatrixAuto.SuspendLayout();
tableLayoutMatrix.SuspendLayout();
panelMatrixTitle.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureMatrix).BeginInit();
@@ -140,6 +145,7 @@ namespace GHelper
panelCPUTitle.SuspendLayout();
((System.ComponentModel.ISupportInitialize)picturePerf).BeginInit();
panelGPU.SuspendLayout();
tableAdditionalGPUFeature.SuspendLayout();
tableAMD.SuspendLayout();
tableGPU.SuspendLayout();
panelGPUTitle.SuspendLayout();
@@ -174,18 +180,58 @@ namespace GHelper
panelMatrix.AccessibleRole = AccessibleRole.Grouping;
panelMatrix.AutoSize = true;
panelMatrix.AutoSizeMode = AutoSizeMode.GrowAndShrink;
panelMatrix.Controls.Add(panelMatrixAuto);
panelMatrix.Controls.Add(tableLayoutMatrix);
panelMatrix.Controls.Add(panelMatrixTitle);
panelMatrix.Controls.Add(checkMatrix);
panelMatrix.Dock = DockStyle.Top;
panelMatrix.Location = new Point(11, 950);
panelMatrix.Margin = new Padding(0);
panelMatrix.Name = "panelMatrix";
panelMatrix.Padding = new Padding(20, 20, 20, 10);
panelMatrix.Size = new Size(827, 176);
panelMatrix.Size = new Size(827, 194);
panelMatrix.TabIndex = 3;
panelMatrix.TabStop = true;
//
// panelMatrixAuto
//
panelMatrixAuto.Controls.Add(checkMatrixLid);
panelMatrixAuto.Controls.Add(checkMatrix);
panelMatrixAuto.Dock = DockStyle.Top;
panelMatrixAuto.Location = new Point(20, 144);
panelMatrixAuto.Margin = new Padding(4);
panelMatrixAuto.Name = "panelMatrixAuto";
panelMatrixAuto.Padding = new Padding(5, 0, 0, 0);
panelMatrixAuto.Size = new Size(787, 40);
panelMatrixAuto.TabIndex = 47;
//
// checkMatrixLid
//
checkMatrixLid.AutoSize = true;
checkMatrixLid.Dock = DockStyle.Left;
checkMatrixLid.ForeColor = SystemColors.GrayText;
checkMatrixLid.Location = new Point(256, 0);
checkMatrixLid.Margin = new Padding(8, 4, 8, 4);
checkMatrixLid.Name = "checkMatrixLid";
checkMatrixLid.Size = new Size(253, 40);
checkMatrixLid.TabIndex = 46;
checkMatrixLid.Text = "Disable on lid close";
checkMatrixLid.UseVisualStyleBackColor = true;
checkMatrixLid.Visible = false;
//
// checkMatrix
//
checkMatrix.AutoSize = true;
checkMatrix.Dock = DockStyle.Left;
checkMatrix.ForeColor = SystemColors.GrayText;
checkMatrix.Location = new Point(5, 0);
checkMatrix.Margin = new Padding(8, 4, 8, 4);
checkMatrix.Name = "checkMatrix";
checkMatrix.Padding = new Padding(0, 0, 10, 0);
checkMatrix.Size = new Size(251, 40);
checkMatrix.TabIndex = 19;
checkMatrix.Text = Properties.Strings.TurnOffOnBattery;
checkMatrix.UseVisualStyleBackColor = true;
//
// tableLayoutMatrix
//
tableLayoutMatrix.AutoSize = true;
@@ -305,18 +351,6 @@ namespace GHelper
labelMatrix.TabIndex = 40;
labelMatrix.Text = "Anime Matrix";
//
// checkMatrix
//
checkMatrix.AutoSize = true;
checkMatrix.ForeColor = SystemColors.GrayText;
checkMatrix.Location = new Point(27, 126);
checkMatrix.Margin = new Padding(8, 4, 8, 4);
checkMatrix.Name = "checkMatrix";
checkMatrix.Size = new Size(249, 36);
checkMatrix.TabIndex = 19;
checkMatrix.Text = Properties.Strings.TurnOffOnBattery;
checkMatrix.UseVisualStyleBackColor = true;
//
// panelBattery
//
panelBattery.AutoSize = true;
@@ -325,7 +359,7 @@ namespace GHelper
panelBattery.Controls.Add(sliderBattery);
panelBattery.Controls.Add(panelBatteryTitle);
panelBattery.Dock = DockStyle.Top;
panelBattery.Location = new Point(11, 1608);
panelBattery.Location = new Point(11, 1626);
panelBattery.Margin = new Padding(0);
panelBattery.Name = "panelBattery";
panelBattery.Padding = new Padding(20, 20, 20, 10);
@@ -417,7 +451,7 @@ namespace GHelper
panelFooter.AutoSizeMode = AutoSizeMode.GrowAndShrink;
panelFooter.Controls.Add(tableButtons);
panelFooter.Dock = DockStyle.Top;
panelFooter.Location = new Point(11, 1783);
panelFooter.Location = new Point(11, 1801);
panelFooter.Margin = new Padding(0);
panelFooter.Name = "panelFooter";
panelFooter.Padding = new Padding(20);
@@ -692,6 +726,7 @@ namespace GHelper
panelGPU.AutoSize = true;
panelGPU.AutoSizeMode = AutoSizeMode.GrowAndShrink;
panelGPU.Controls.Add(labelTipGPU);
panelGPU.Controls.Add(tableAdditionalGPUFeature);
panelGPU.Controls.Add(tableAMD);
panelGPU.Controls.Add(tableGPU);
panelGPU.Controls.Add(panelGPUTitle);
@@ -714,6 +749,46 @@ namespace GHelper
labelTipGPU.Size = new Size(787, 36);
labelTipGPU.TabIndex = 20;
//
// tableAdditionalGPUFeature
//
tableAdditionalGPUFeature.AutoSize = true;
tableAdditionalGPUFeature.AutoSizeMode = AutoSizeMode.GrowAndShrink;
tableAdditionalGPUFeature.ColumnCount = 3;
tableAdditionalGPUFeature.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.3333321F));
tableAdditionalGPUFeature.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.3333321F));
tableAdditionalGPUFeature.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.3333321F));
tableAdditionalGPUFeature.Controls.Add(buttonAutoTDP, 0, 0);
tableAdditionalGPUFeature.Dock = DockStyle.Top;
tableAdditionalGPUFeature.Location = new Point(10, 198);
tableAdditionalGPUFeature.Margin = new Padding(2, 1, 2, 1);
tableAdditionalGPUFeature.Name = "tableAdditionalGPUFeature";
tableAdditionalGPUFeature.RowCount = 1;
tableAdditionalGPUFeature.RowStyles.Add(new RowStyle(SizeType.Absolute, 60F));
tableAdditionalGPUFeature.Size = new Size(392, 60);
tableAdditionalGPUFeature.TabIndex = 25;
//
// buttonAutoTDP
//
buttonAutoTDP.Activated = false;
buttonAutoTDP.BackColor = SystemColors.ControlLightLight;
buttonAutoTDP.BorderColor = Color.Transparent;
buttonAutoTDP.BorderRadius = 5;
buttonAutoTDP.Dock = DockStyle.Fill;
buttonAutoTDP.FlatAppearance.BorderSize = 0;
buttonAutoTDP.FlatStyle = FlatStyle.Flat;
buttonAutoTDP.ForeColor = SystemColors.ControlText;
buttonAutoTDP.Image = Properties.Resources.icons8_processor_32;
buttonAutoTDP.ImageAlign = ContentAlignment.MiddleRight;
buttonAutoTDP.Location = new Point(1, 1);
buttonAutoTDP.Margin = new Padding(1, 1, 1, 1);
buttonAutoTDP.Name = "buttonAutoTDP";
buttonAutoTDP.Secondary = false;
buttonAutoTDP.Size = new Size(128, 38);
buttonAutoTDP.TabIndex = 11;
buttonAutoTDP.Text = "Auto TDP";
buttonAutoTDP.TextImageRelation = TextImageRelation.ImageBeforeText;
buttonAutoTDP.UseVisualStyleBackColor = false;
//
// tableAMD
//
tableAMD.AutoSize = true;
@@ -1164,7 +1239,7 @@ namespace GHelper
panelKeyboard.Controls.Add(tableLayoutKeyboard);
panelKeyboard.Controls.Add(panelKeyboardTitle);
panelKeyboard.Dock = DockStyle.Top;
panelKeyboard.Location = new Point(11, 1266);
panelKeyboard.Location = new Point(11, 1284);
panelKeyboard.Margin = new Padding(0);
panelKeyboard.Name = "panelKeyboard";
panelKeyboard.Padding = new Padding(20);
@@ -1340,7 +1415,7 @@ namespace GHelper
panelVersion.Controls.Add(labelCharge);
panelVersion.Controls.Add(checkStartup);
panelVersion.Dock = DockStyle.Top;
panelVersion.Location = new Point(11, 1727);
panelVersion.Location = new Point(11, 1745);
panelVersion.Margin = new Padding(4);
panelVersion.Name = "panelVersion";
panelVersion.Size = new Size(827, 56);
@@ -1365,7 +1440,7 @@ namespace GHelper
panelPeripherals.Controls.Add(tableLayoutPeripherals);
panelPeripherals.Controls.Add(panelPeripheralsTile);
panelPeripherals.Dock = DockStyle.Top;
panelPeripherals.Location = new Point(11, 1410);
panelPeripherals.Location = new Point(11, 1428);
panelPeripherals.Margin = new Padding(0);
panelPeripherals.Name = "panelPeripherals";
panelPeripherals.Padding = new Padding(20, 20, 20, 10);
@@ -1507,7 +1582,7 @@ namespace GHelper
panelAlly.Controls.Add(tableLayoutAlly);
panelAlly.Controls.Add(panelAllyTitle);
panelAlly.Dock = DockStyle.Top;
panelAlly.Location = new Point(11, 1126);
panelAlly.Location = new Point(11, 1144);
panelAlly.Margin = new Padding(0);
panelAlly.Name = "panelAlly";
panelAlly.Padding = new Padding(20, 20, 20, 0);
@@ -1739,6 +1814,8 @@ namespace GHelper
Text = "G-Helper";
panelMatrix.ResumeLayout(false);
panelMatrix.PerformLayout();
panelMatrixAuto.ResumeLayout(false);
panelMatrixAuto.PerformLayout();
tableLayoutMatrix.ResumeLayout(false);
panelMatrixTitle.ResumeLayout(false);
panelMatrixTitle.PerformLayout();
@@ -1757,6 +1834,7 @@ namespace GHelper
((System.ComponentModel.ISupportInitialize)picturePerf).EndInit();
panelGPU.ResumeLayout(false);
panelGPU.PerformLayout();
tableAdditionalGPUFeature.ResumeLayout(false);
tableAMD.ResumeLayout(false);
tableGPU.ResumeLayout(false);
panelGPUTitle.ResumeLayout(false);
@@ -1896,5 +1974,9 @@ namespace GHelper
private Label labelGamma;
private PictureBox pictureGamma;
private Label labelGammaTitle;
private CheckBox checkMatrixLid;
private Panel panelMatrixAuto;
private TableLayoutPanel tableAdditionalGPUFeature;
private RButton buttonAutoTDP;
}
}

View File

@@ -1,5 +1,6 @@
using GHelper.Ally;
using GHelper.AnimeMatrix;
using GHelper.AutoTDP;
using GHelper.AutoUpdate;
using GHelper.Battery;
using GHelper.Display;
@@ -28,6 +29,7 @@ namespace GHelper
AutoUpdateControl updateControl;
AsusMouseSettings? mouseSettings;
AutoTDPUI? autoTdpUi;
public AniMatrixControl matrixControl;
@@ -85,6 +87,7 @@ namespace GHelper
labelPeripherals.Text = Properties.Strings.Peripherals;
checkMatrix.Text = Properties.Strings.TurnOffOnBattery;
checkMatrixLid.Text = Properties.Strings.DisableOnLidClose;
checkStartup.Text = Properties.Strings.RunOnStartup;
buttonMatrix.Text = Properties.Strings.PictureGif;
@@ -218,7 +221,7 @@ namespace GHelper
sliderBattery.ValueChanged += SliderBattery_ValueChanged;
Program.trayIcon.MouseMove += TrayIcon_MouseMove;
sensorTimer = new System.Timers.Timer(1000);
sensorTimer = new System.Timers.Timer(AppConfig.Get("sensor_timer",1000));
sensorTimer.Elapsed += OnTimedEvent;
sensorTimer.Enabled = true;
@@ -243,6 +246,8 @@ namespace GHelper
buttonFPS.Click += ButtonFPS_Click;
buttonOverlay.Click += ButtonOverlay_Click;
buttonAutoTDP.Click += ButtonAutoTDP_Click;
Text = "G-Helper " + (ProcessHelper.IsUserAdministrator() ? "—" : "-") + " " + AppConfig.GetModelShort();
TopMost = AppConfig.Is("topmost");
@@ -253,16 +258,58 @@ namespace GHelper
VisualiseFnLock();
buttonFnLock.Click += ButtonFnLock_Click;
panelGamma.Visible = AppConfig.IsOLED();
sliderGamma.ValueChanged += SliderGamma_ValueChanged;
labelGamma.Text = "100%";
panelPerformance.Focus();
InitBrightness();
}
public void InitBrightness()
{
if (!AppConfig.IsOLED()) return;
panelGamma.Visible = true;
int brightness = AppConfig.Get("brightness");
if (brightness >= 0) sliderGamma.Value = brightness;
sliderGamma.ValueChanged += SliderGamma_ValueChanged;
labelGamma.Text = sliderGamma.Value + "%";
}
private void ButtonAutoTDP_Click(object? sender, EventArgs e)
{
if (autoTdpUi is not null)
{
return;
}
autoTdpUi = new AutoTDPUI();
autoTdpUi.FormClosed += AutoTdpUi_FormClosed;
autoTdpUi.Disposed += AutoTdpUi_Disposed;
if (!autoTdpUi.IsDisposed)
{
autoTdpUi.Show();
}
else
{
autoTdpUi = null;
}
}
private void AutoTdpUi_Disposed(object? sender, EventArgs e)
{
autoTdpUi = null;
}
private void AutoTdpUi_FormClosed(object? sender, FormClosedEventArgs e)
{
autoTdpUi = null;
}
private void SliderGamma_ValueChanged(object? sender, EventArgs e)
{
screenControl.SetGamma(sliderGamma.Value);
screenControl.SetBrightness(sliderGamma.Value);
labelGamma.Text = sliderGamma.Value + "%";
}
@@ -410,6 +457,8 @@ namespace GHelper
Task.Run((Action)RefreshPeripheralsBattery);
updateControl.CheckForUpdates();
tableAdditionalGPUFeature.Visible = AutoTDPService.IsAvailable();
}
}
@@ -455,10 +504,14 @@ namespace GHelper
case 0:
Logger.WriteLine("Lid Closed");
Aura.ApplyBrightness(0, "Lid");
AniMatrixControl.lidClose = true;
matrixControl.SetLidMode();
break;
case 1:
Logger.WriteLine("Lid Open");
Aura.ApplyBrightness(InputDispatcher.GetBacklight(), "Lid");
AniMatrixControl.lidClose = false;
matrixControl.SetLidMode();
break;
}
@@ -701,6 +754,11 @@ namespace GHelper
matrixControl.SetBatteryAuto();
}
private void CheckMatrixLid_CheckedChanged(object? sender, EventArgs e)
{
AppConfig.Set("matrix_lid", checkMatrixLid.Checked ? 1 : 0);
matrixControl.SetLidMode(true);
}
private void ButtonMatrix_Click(object? sender, EventArgs e)
@@ -929,7 +987,8 @@ namespace GHelper
for (int i = 1; i <= 5; i++) comboInterval.Items.Add($"Interval {i}s");
buttonMatrix.Visible = false;
}
checkMatrixLid.Visible = true;
}
comboMatrix.SelectedIndex = Math.Min(AppConfig.Get("matrix_brightness", 0), comboMatrix.Items.Count - 1);
comboMatrixRunning.SelectedIndex = Math.Min(AppConfig.Get("matrix_running", 0), comboMatrixRunning.Items.Count - 1);
@@ -938,6 +997,10 @@ namespace GHelper
checkMatrix.Checked = AppConfig.Is("matrix_auto");
checkMatrix.CheckedChanged += CheckMatrix_CheckedChanged;
checkMatrixLid.Checked = AppConfig.Is("matrix_lid");
checkMatrixLid.CheckedChanged += CheckMatrixLid_CheckedChanged;
}
@@ -1066,6 +1129,7 @@ namespace GHelper
private void ButtonQuit_Click(object? sender, EventArgs e)
{
Program.autoTDPService.Shutdown();
matrixControl.Dispose();
Close();
Program.trayIcon.Visible = false;

View File

@@ -36,7 +36,7 @@ namespace GHelper
(bios, model) = AppConfig.GetBiosAndModel();
buttonRefresh.TabStop = false;
updatesCount = 0;
labelUpdates.ForeColor = colorEco;
labelUpdates.Text = Properties.Strings.NoNewUpdates;
@@ -83,13 +83,12 @@ namespace GHelper
InitializeComponent();
InitTheme(true);
LoadUpdates(true);
//buttonRefresh.Visible = false;
buttonRefresh.Click += ButtonRefresh_Click;
Shown += Updates_Shown;
}
private void ButtonRefresh_Click(object? sender, EventArgs e)
{
LoadUpdates();
@@ -100,7 +99,9 @@ namespace GHelper
Height = Program.settingsForm.Height;
Top = Program.settingsForm.Top;
Left = Program.settingsForm.Left - Width - 5;
LoadUpdates(true);
}
private Dictionary<string, string> GetDeviceVersions()
{
using (ManagementObjectSearcher objSearcher = new ManagementObjectSearcher("Select * from Win32_PnPSignedDriver"))
@@ -160,24 +161,36 @@ namespace GHelper
});
}
public void VisualiseNewDriver(int position, int newer, TableLayoutPanel table)
private void _VisualiseNewDriver(int position, int newer, TableLayoutPanel table)
{
var label = table.GetControlFromPosition(3, position) as LinkLabel;
if (label != null)
{
if (newer == DRIVER_NEWER)
{
label.AccessibleName = label.AccessibleName + Properties.Strings.NewUpdates;
label.Font = new Font(label.Font, FontStyle.Underline | FontStyle.Bold);
label.LinkColor = colorTurbo;
}
if (newer == DRIVER_NOT_FOUND) label.LinkColor = Color.Gray;
}
}
public void VisualiseNewDriver(int position, int newer, TableLayoutPanel table)
{
if (InvokeRequired)
{
Invoke(delegate
{
if (newer == DRIVER_NEWER)
{
label.AccessibleName = label.AccessibleName + Properties.Strings.NewUpdates;
label.Font = new Font(label.Font, FontStyle.Underline | FontStyle.Bold);
label.LinkColor = colorTurbo;
}
if (newer == DRIVER_NOT_FOUND) label.LinkColor = Color.Gray;
_VisualiseNewDriver(position, newer, table);
});
} else
{
_VisualiseNewDriver(position, newer, table);
}
}
public void VisualiseNewCount(int updatesCount, TableLayoutPanel table)
@@ -193,7 +206,7 @@ namespace GHelper
});
}
public async void DriversAsync(string url, int type, TableLayoutPanel table)
public async void DriversAsync(string url, int type, TableLayoutPanel table)
{
try
@@ -266,7 +279,7 @@ namespace GHelper
foreach (var localVersion in localVersions)
{
newer = Math.Min(newer, new Version(driver.version).CompareTo(new Version(localVersion)));
Logger.WriteLine(driver.title + " " + deviceID + " "+ driver.version + " vs " + localVersion + " = " + newer);
Logger.WriteLine(driver.title + " " + deviceID + " " + driver.version + " vs " + localVersion + " = " + newer);
}
}

View File

@@ -1,10 +1,10 @@
# G-Helper - Lightweight control tool for Asus laptops
[![United24](https://raw.githubusercontent.com/seerge/g-helper/main/docs/ua.png)](https://u24.gov.ua/)
[![GitHub release](https://img.shields.io/github/release/seerge/g-helper.svg?style=flat-square)](https://GitHub.com/seerge/g-helper/releases/)
[![Github all releases](https://img.shields.io/github/downloads/seerge/g-helper/total.svg?style=flat-square)](https://GitHub.com/seerge/g-helper/releases/) [![GitHub stars](https://img.shields.io/github/stars/seerge/g-helper.svg?style=social)](https://GitHub.com/seerge/g-helper/stargazers/)
[![GitHub release](https://img.shields.io/github/release/seerge/g-helper)](https://GitHub.com/seerge/g-helper/releases/)
[![Github all releases](https://img.shields.io/github/downloads/seerge/g-helper/total)](https://GitHub.com/seerge/g-helper/releases/) [![GitHub stars](https://img.shields.io/github/stars/seerge/g-helper.svg?style=social)](https://GitHub.com/seerge/g-helper/stargazers/)
Small and lightweight Armoury Crate alternative for Asus laptops offering almost same functionality without extra bloat and unnecessary services.
Works with all popular models, such as ROG Zephyrus G14, G15, G16, M16, Flow X13, Flow X16, Flow Z13, TUF Series, Strix / Scar Series, ProArt, VivoBook and many more!
Works with all popular models, such as ROG Zephyrus G14, G15, G16, M16, Flow X13, Flow X16, Flow Z13, TUF Series, Strix / Scar Series, ProArt, VivoBook, Ally and many more!
# [:floppy_disk:Download](https://github.com/seerge/g-helper/releases/latest/download/GHelper.zip)
@@ -124,6 +124,14 @@ Huge thanks to [@IceStormNG](https://github.com/IceStormNG) 👑 for contributio
- ``Ctrl + Shift + Alt + F20`` - Custom 2 (if exists)
- [Custom keybindings / hotkeys](https://github.com/seerge/g-helper/wiki/Power-user-settings#custom-hotkey-actions)
### 🎮ROG Ally Bindings
- ``M + DPad Left / Right`` - Display Brightness
- ``M + DPad Up`` - Touch keyboard
- ``M + DPad Down`` - Show desktop
- ``M + Y`` - Toggle AMD overay
- ``M + X`` - Screenshot
- ``M + Right Stick Click`` - Controller Mode
------------------
#### If you like the app you can make a Donation