mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
234 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
479572e39d | ||
|
|
460267aac7 | ||
|
|
e71c8e32ef | ||
|
|
6fe6492df3 | ||
|
|
c61f4d1608 | ||
|
|
8e1099545a | ||
|
|
7740678cd4 | ||
|
|
c6faec9628 | ||
|
|
3a5c4de9b6 | ||
|
|
f90fec24b9 | ||
|
|
240537dbd4 | ||
|
|
cc3c16cdf1 | ||
|
|
a7c662a0d4 | ||
|
|
b0958cb2fc | ||
|
|
29f27ed4d6 | ||
|
|
801096299b | ||
|
|
5ed1de0fcf | ||
|
|
0ec0a382e9 | ||
|
|
e810adb358 | ||
|
|
dc6c94fe4a | ||
|
|
8479c129ff | ||
|
|
3173c2e688 | ||
|
|
730ba0a2f9 | ||
|
|
d26a83287d | ||
|
|
47deb669d1 | ||
|
|
a30f5d801b | ||
|
|
75f4b9f2c5 | ||
|
|
2289f36ba5 | ||
|
|
6322e25e78 | ||
|
|
62c0147548 | ||
|
|
9bd2688da2 | ||
|
|
9649814085 | ||
|
|
1ebc2021f6 | ||
|
|
52b165f250 | ||
|
|
b2ed390bdf | ||
|
|
1588f84c97 | ||
|
|
a3a2fdfe14 | ||
|
|
2c867eb960 | ||
|
|
6fbf4f2a49 | ||
|
|
d4ecb2bcf3 | ||
|
|
c70c6ef4d6 | ||
|
|
5d77d5c700 | ||
|
|
89f096778d | ||
|
|
2b9fc913ad | ||
|
|
4acbf5adf1 | ||
|
|
48ea1b588f | ||
|
|
cb15161fc4 | ||
|
|
d95a612788 | ||
|
|
0a724926ee | ||
|
|
353ed998db | ||
|
|
0afee18f20 | ||
|
|
8154883d49 | ||
|
|
feb4198c0f | ||
|
|
6edf2d9447 | ||
|
|
25f0af1103 | ||
|
|
4f9cc4a94e | ||
|
|
e973f09f4e | ||
|
|
cd0662e11f | ||
|
|
ee43af2824 | ||
|
|
d620ca010c | ||
|
|
6bd77ab45b | ||
|
|
99a490996d | ||
|
|
096ea3b8e9 | ||
|
|
5f10f5b1e8 | ||
|
|
36219383ce | ||
|
|
78862c6558 | ||
|
|
b53a46bb3b | ||
|
|
15a681af3b | ||
|
|
6341ec7d34 | ||
|
|
596c47d371 | ||
|
|
7ff8fec35c | ||
|
|
b96185222c | ||
|
|
3346bd5f0e | ||
|
|
34404feb5b | ||
|
|
552bc1020d | ||
|
|
6d0bb5bef7 | ||
|
|
00d80ce7a9 | ||
|
|
08e1ed54cd | ||
|
|
97a22c59f7 | ||
|
|
d2aa5e9c42 | ||
|
|
2cb0ffab4b | ||
|
|
e3cb2bb4a1 | ||
|
|
5a734c00c1 | ||
|
|
d85ec73a27 | ||
|
|
4b9eb99870 | ||
|
|
c9b939b876 | ||
|
|
9562f77c6f | ||
|
|
7120d2a009 | ||
|
|
4fa4295748 | ||
|
|
23f28a8ce5 | ||
|
|
a94321df04 | ||
|
|
9917f5543c | ||
|
|
78367727ae | ||
|
|
32b83d724d | ||
|
|
77b420483d | ||
|
|
9b7842a5e9 | ||
|
|
bee7f35475 | ||
|
|
2daf1f5434 | ||
|
|
e979bf708f | ||
|
|
4d60b1f36d | ||
|
|
8a7c35c7cc | ||
|
|
2ecdcd196d | ||
|
|
fdd2373b37 | ||
|
|
ca7ed6c7e9 | ||
|
|
0cad6bd7a9 | ||
|
|
4545eac93d | ||
|
|
c43e4937d6 | ||
|
|
e74d730f0c | ||
|
|
676da38b5f | ||
|
|
b3563e0857 | ||
|
|
b2a01a8bdc | ||
|
|
74fd05d048 | ||
|
|
12dc05c5b9 | ||
|
|
e82dab5e7c | ||
|
|
602dfea1a6 | ||
|
|
c13a6e9ded | ||
|
|
e11027963f | ||
|
|
9d2b8b506e | ||
|
|
988c9e11dd | ||
|
|
2c6bb32e4a | ||
|
|
e33a0d05ed | ||
|
|
1c283766aa | ||
|
|
f2ef6d197f | ||
|
|
13ec0f8911 | ||
|
|
fcf213f1a0 | ||
|
|
c73b4fce97 | ||
|
|
aab1e08729 | ||
|
|
cf3a84aa3d | ||
|
|
8d119b386d | ||
|
|
0605e63433 | ||
|
|
4634404ed4 | ||
|
|
dcfaf665cd | ||
|
|
15e791cbfd | ||
|
|
5d86c821f6 | ||
|
|
e5de404e5c | ||
|
|
13aa98e954 | ||
|
|
75c397d7a4 | ||
|
|
0ad8efdb7d | ||
|
|
2064f29433 | ||
|
|
890c50d90e | ||
|
|
bd207113f8 | ||
|
|
650a5ff5c0 | ||
|
|
01ce91a474 | ||
|
|
253e1eb095 | ||
|
|
b95768d547 | ||
|
|
dfbfd16d23 | ||
|
|
3eeac0353a | ||
|
|
5e7c9a4191 | ||
|
|
ee84ba6304 | ||
|
|
d15c6cb073 | ||
|
|
1e683a0884 | ||
|
|
1ad48bf763 | ||
|
|
dcc052a574 | ||
|
|
38fca560df | ||
|
|
7e0459bd44 | ||
|
|
228ad70b8d | ||
|
|
b42e565cd6 | ||
|
|
e021d59737 | ||
|
|
dba7967ad5 | ||
|
|
a7a7170676 | ||
|
|
1d43ca3ce4 | ||
|
|
ff7618f16f | ||
|
|
bb947bf8bf | ||
|
|
63092d8415 | ||
|
|
6fbce2f495 | ||
|
|
8d89a04608 | ||
|
|
0cbc48d526 | ||
|
|
81013ca0be | ||
|
|
af2509fc17 | ||
|
|
136b5b4f55 | ||
|
|
4e2abff942 | ||
|
|
2c8a11fc24 | ||
|
|
8af8823ee4 | ||
|
|
ec0a1b710e | ||
|
|
2ac2e84161 | ||
|
|
14dc1741f7 | ||
|
|
fbed195194 | ||
|
|
0d002edf65 | ||
|
|
28a17562a8 | ||
|
|
583cb677d0 | ||
|
|
1888fe7bd9 | ||
|
|
089b339e61 | ||
|
|
cab4a04339 | ||
|
|
7ab3b450cd | ||
|
|
ea2dc7b75d | ||
|
|
ccd69a8628 | ||
|
|
c1d23159a0 | ||
|
|
1c865624e6 | ||
|
|
4853c09c2c | ||
|
|
08704d6826 | ||
|
|
6edbcf5ecd | ||
|
|
7702dc8e38 | ||
|
|
94391358ef | ||
|
|
feecd193ac | ||
|
|
444f7c76f0 | ||
|
|
701423fa0e | ||
|
|
7b3a6d319b | ||
|
|
8bc9325b3f | ||
|
|
64195c5082 | ||
|
|
2297532323 | ||
|
|
daac8b0a45 | ||
|
|
f061e3f43a | ||
|
|
85e02549f1 | ||
|
|
9053764930 | ||
|
|
64871e5554 | ||
|
|
b1c778b30d | ||
|
|
6932bb1889 | ||
|
|
c90a342ce8 | ||
|
|
f223ca4a33 | ||
|
|
023607da4b | ||
|
|
264631ab77 | ||
|
|
1bd5d79983 | ||
|
|
83b184a061 | ||
|
|
9ff572b8f6 | ||
|
|
cdb633be04 | ||
|
|
7cb9b1f64f | ||
|
|
06be8c726e | ||
|
|
265c6ce417 | ||
|
|
add852ce5d | ||
|
|
d4a5164b16 | ||
|
|
14618ee19e | ||
|
|
0b3a75e373 | ||
|
|
64e390a61f | ||
|
|
1cd808de07 | ||
|
|
d82f1c8d70 | ||
|
|
9189cf0a46 | ||
|
|
3a7c4278a0 | ||
|
|
7065ba8661 | ||
|
|
1bce4a4b51 | ||
|
|
468f9c4034 | ||
|
|
4d347df45c | ||
|
|
d7f1d1d5fd | ||
|
|
6800ae38dd | ||
|
|
9b2b96fbf0 |
13
.github/FUNDING.yml
vendored
Normal file
13
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
custom: https://www.paypal.com/donate/?hosted_button_id=4HMSHS4EBQWTA
|
||||
32
.github/ISSUE_TEMPLATE/bug_report.md
vendored
32
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,38 +1,42 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
|
||||
## NOTE
|
||||
Bug reports without clear information or scenario to reproduce and logs from ``%AppData%\GHelper`` will be closed without answer.
|
||||
Please respect time of the developer. Thanks.
|
||||
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
**Clear scenario to Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
4. Explanation of an error or a bug
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
**App Logs**
|
||||
Please include and attach log.txt from ``%AppData%\GHelper``
|
||||
|
||||
**Screenshots or screencasts**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
- OS: [e.g. Windows 11]
|
||||
- Laptop model
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
**Asus software**
|
||||
- Armoury crate (or it's services installed)
|
||||
- MyASUS installed
|
||||
- Other Asus services running in background
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
|
||||
10
.github/ISSUE_TEMPLATE/custom.md
vendored
10
.github/ISSUE_TEMPLATE/custom.md
vendored
@@ -1,10 +0,0 @@
|
||||
---
|
||||
name: Custom issue template
|
||||
about: Describe this issue template's purpose here.
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
|
||||
164
app/ASUSWmi.cs
164
app/ASUSWmi.cs
@@ -10,30 +10,52 @@ public class ASUSWmi
|
||||
const uint DSTS = 0x53545344;
|
||||
const uint DEVS = 0x53564544;
|
||||
|
||||
public const uint UniversalControl = 0x00100021;
|
||||
public const int KB_Light_Up = 0xc4;
|
||||
public const int KB_Light_Down = 0xc5;
|
||||
|
||||
public const int ChargerMode = 0x0012006C;
|
||||
|
||||
public const int ChargerUSB = 2;
|
||||
public const int ChargerBarrel = 1;
|
||||
|
||||
public const uint CPU_Fan = 0x00110013;
|
||||
public const uint GPU_Fan = 0x00110014;
|
||||
public const uint Mid_Fan = 0x00110031;
|
||||
|
||||
public const uint PerformanceMode = 0x00120075; // Thermal Control
|
||||
|
||||
public const uint GPUEco = 0x00090020;
|
||||
public const uint GPUXGConnected = 0x00090018;
|
||||
public const uint GPUXG = 0x00090019;
|
||||
public const uint GPUMux = 0x00090016;
|
||||
|
||||
public const uint BatteryLimit = 0x00120057;
|
||||
public const uint ScreenOverdrive = 0x00050019;
|
||||
public const uint ScreenMiniled = 0x0005001E;
|
||||
|
||||
public const uint DevsCPUFanCurve = 0x00110024;
|
||||
public const uint DevsGPUFanCurve = 0x00110025;
|
||||
public const uint DevsMidFanCurve = 0x00110032;
|
||||
|
||||
public const int PPT_TotalA0 = 0x001200A0; // Total PPT on 2022 and CPU PPT on 2021
|
||||
public const int Temp_CPU = 0x00120094;
|
||||
public const int Temp_GPU = 0x00120097;
|
||||
|
||||
public const int PPT_TotalA0 = 0x001200A0; // Total PPT on 2022 (PPT_LIMIT_SLOW ) and CPU PPT on 2021
|
||||
public const int PPT_EDCA1 = 0x001200A1; // CPU EDC
|
||||
public const int PPT_TDCA2 = 0x001200A2; // CPU TDC
|
||||
public const int PPT_APUA3 = 0x001200A3; // APU PPT ON 2021, doesn't work on 2022
|
||||
|
||||
public const int PPT_CPUB0 = 0x001200B0; // CPU PPT on 2022
|
||||
public const int PPT_CPUB1 = 0x001200B1; // APU PPT on 2022
|
||||
public const int PPT_CPUB0 = 0x001200B0; // CPU PPT on 2022 (PPT_LIMIT_APU)
|
||||
public const int PPT_CPUB1 = 0x001200B1; // Total PPT on 2022 (PPT_LIMIT_SLOW)
|
||||
|
||||
public const int PPT_APUC1 = 0x001200C1;
|
||||
public const int PPT_APUC2 = 0x001200C2;
|
||||
public const int PPT_GPUC0 = 0x001200C0; // NVIDIA GPU Boost
|
||||
public const int PPT_APUC1 = 0x001200C1; // Actual Power Limit (PPT_LIMIT_FAST) AND Sustained Power Limit (STAPM_LIMIT)
|
||||
public const int PPT_GPUC2 = 0x001200C2; // NVIDIA GPU Temp Target (75.. 87 C)
|
||||
|
||||
public const int TUF_KB_BRIGHTNESS = 0x00050021;
|
||||
public const int TUF_KB = 0x00100056;
|
||||
public const int TUF_KB_STATE = 0x00100057;
|
||||
|
||||
public const int PerformanceBalanced = 0;
|
||||
public const int PerformanceTurbo = 1;
|
||||
@@ -44,14 +66,20 @@ public class ASUSWmi
|
||||
public const int GPUModeUltimate = 2;
|
||||
|
||||
|
||||
public const int MaxTotal = 150;
|
||||
public const int MaxTotal = 250;
|
||||
public const int MinTotal = 5;
|
||||
public const int DefaultTotal = 125;
|
||||
|
||||
public const int MaxCPU = 90;
|
||||
public const int MaxCPU = 130;
|
||||
public const int MinCPU = 5;
|
||||
public const int DefaultCPU = 80;
|
||||
|
||||
public const int MinGPUBoost = 5;
|
||||
public const int MaxGPUBoost = 25;
|
||||
|
||||
public const int MinGPUTemp = 75;
|
||||
public const int MaxGPUTemp = 87;
|
||||
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||
private static extern IntPtr CreateFile(
|
||||
@@ -143,21 +171,31 @@ public class ASUSWmi
|
||||
|
||||
}
|
||||
|
||||
public void DeviceSet(uint DeviceID, int Status)
|
||||
public int DeviceSet(uint DeviceID, int Status, string logName)
|
||||
{
|
||||
byte[] args = new byte[8];
|
||||
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
||||
BitConverter.GetBytes((uint)Status).CopyTo(args, 4);
|
||||
CallMethod(DEVS, args);
|
||||
|
||||
byte[] status = CallMethod(DEVS, args);
|
||||
int result = BitConverter.ToInt32(status, 0);
|
||||
|
||||
Logger.WriteLine(logName + " = " + Status + " : " + (result == 1 ? "OK" : result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public void DeviceSet(uint DeviceID, byte[] Params)
|
||||
public int DeviceSet(uint DeviceID, byte[] Params, string logName)
|
||||
{
|
||||
byte[] args = new byte[4 + Params.Length];
|
||||
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
||||
Params.CopyTo(args, 4);
|
||||
CallMethod(DEVS, args);
|
||||
|
||||
byte[] status = CallMethod(DEVS, args);
|
||||
int result = BitConverter.ToInt32(status, 0);
|
||||
|
||||
Logger.WriteLine(logName + " = " + BitConverter.ToString(Params) + " : " + (result == 1 ? "OK" : result));
|
||||
return BitConverter.ToInt32(status, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +204,9 @@ public class ASUSWmi
|
||||
byte[] args = new byte[8];
|
||||
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
||||
byte[] status = CallMethod(DSTS, args);
|
||||
|
||||
return BitConverter.ToInt32(status, 0) - 65536;
|
||||
|
||||
}
|
||||
|
||||
public byte[] DeviceGetBuffer(uint DeviceID, uint Status = 0)
|
||||
@@ -174,22 +214,38 @@ public class ASUSWmi
|
||||
byte[] args = new byte[8];
|
||||
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
||||
BitConverter.GetBytes((uint)Status).CopyTo(args, 4);
|
||||
|
||||
return CallMethod(DSTS, args);
|
||||
}
|
||||
|
||||
|
||||
public void SetFanCurve(int device, byte[] curve)
|
||||
public int SetFanCurve(int device, byte[] curve)
|
||||
{
|
||||
|
||||
if (curve.Length != 16) return;
|
||||
if (curve.All(singleByte => singleByte == 0)) return;
|
||||
if (curve.Length != 16) return -1;
|
||||
if (curve.All(singleByte => singleByte == 0)) return -1;
|
||||
|
||||
Logger.WriteLine("Fans" + ((device == 1) ? "GPU" : "CPU") + " " + BitConverter.ToString(curve));
|
||||
int result;
|
||||
|
||||
if (device == 1)
|
||||
DeviceSet(DevsGPUFanCurve, curve);
|
||||
else
|
||||
DeviceSet(DevsCPUFanCurve, curve);
|
||||
for (int i = 8; i < curve.Length; i++)
|
||||
{
|
||||
curve[i] = Math.Max((byte)0, Math.Min((byte)99, curve[i])); // it seems to be a bug, when some old model's bios can go nuts if fan is set to 100%
|
||||
}
|
||||
|
||||
switch (device)
|
||||
{
|
||||
case 1:
|
||||
result = DeviceSet(DevsGPUFanCurve, curve, "FanGPU");
|
||||
break;
|
||||
case 2:
|
||||
result = DeviceSet(DevsMidFanCurve, curve, "FanMid");
|
||||
break;
|
||||
default:
|
||||
result = DeviceSet(DevsCPUFanCurve, curve, "FanCPU");
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public byte[] GetFanCurve(int device, int mode = 0)
|
||||
@@ -204,20 +260,72 @@ public class ASUSWmi
|
||||
default: fan_mode = 0; break;
|
||||
}
|
||||
|
||||
if (device == 1)
|
||||
return DeviceGetBuffer(DevsGPUFanCurve, fan_mode);
|
||||
else
|
||||
return DeviceGetBuffer(DevsCPUFanCurve, fan_mode);
|
||||
switch (device)
|
||||
{
|
||||
case 1:
|
||||
return DeviceGetBuffer(DevsGPUFanCurve, fan_mode);
|
||||
case 2:
|
||||
return DeviceGetBuffer(DevsMidFanCurve, fan_mode);
|
||||
default:
|
||||
return DeviceGetBuffer(DevsCPUFanCurve, fan_mode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void TUFKeyboardBrightness(int brightness)
|
||||
{
|
||||
int param = 0x80 | (brightness & 0x7F);
|
||||
DeviceSet(TUF_KB_BRIGHTNESS, param, "TUF Brightness");
|
||||
}
|
||||
|
||||
public void TUFKeyboardRGB(int mode, Color color, int speed)
|
||||
{
|
||||
|
||||
byte[] setting = new byte[12];
|
||||
setting[0] = (byte)0xB4;
|
||||
setting[1] = (byte)mode;
|
||||
setting[2] = color.R;
|
||||
setting[3] = color.G;
|
||||
setting[4] = color.B;
|
||||
setting[5] = (byte)speed;
|
||||
|
||||
DeviceSet(TUF_KB, setting, "TUF RGB");
|
||||
//Debug.WriteLine(BitConverter.ToString(setting));
|
||||
|
||||
}
|
||||
|
||||
const int ASUS_WMI_KEYBOARD_POWER_BOOT = 0x03 << 16;
|
||||
const int ASUS_WMI_KEYBOARD_POWER_AWAKE = 0x0C << 16;
|
||||
const int ASUS_WMI_KEYBOARD_POWER_SLEEP = 0x30 << 16;
|
||||
const int ASUS_WMI_KEYBOARD_POWER_SHUTDOWN = 0xC0 << 16;
|
||||
public void TUFKeyboardPower(bool awake = true, bool boot = false, bool sleep = false, bool shutdown = false)
|
||||
{
|
||||
int state = 0xbd;
|
||||
|
||||
if (boot) state = state | ASUS_WMI_KEYBOARD_POWER_BOOT;
|
||||
if (awake) state = state | ASUS_WMI_KEYBOARD_POWER_AWAKE;
|
||||
if (sleep) state = state | ASUS_WMI_KEYBOARD_POWER_SLEEP;
|
||||
if (shutdown) state = state | ASUS_WMI_KEYBOARD_POWER_SHUTDOWN;
|
||||
|
||||
state = state | 0x01 << 8;
|
||||
|
||||
DeviceSet(TUF_KB_STATE, state, "TUF_KB");
|
||||
}
|
||||
|
||||
public void SubscribeToEvents(Action<object, EventArrivedEventArgs> EventHandler)
|
||||
{
|
||||
ManagementEventWatcher watcher = new ManagementEventWatcher();
|
||||
watcher.EventArrived += new EventArrivedEventHandler(EventHandler);
|
||||
watcher.Scope = new ManagementScope("root\\wmi");
|
||||
watcher.Query = new WqlEventQuery("SELECT * FROM AsusAtkWmiEvent");
|
||||
watcher.Start();
|
||||
try
|
||||
{
|
||||
ManagementEventWatcher watcher = new ManagementEventWatcher();
|
||||
watcher.EventArrived += new EventArrivedEventHandler(EventHandler);
|
||||
watcher.Scope = new ManagementScope("root\\wmi");
|
||||
watcher.Query = new WqlEventQuery("SELECT * FROM AsusAtkWmiEvent");
|
||||
watcher.Start();
|
||||
} catch
|
||||
{
|
||||
Logger.WriteLine("Can't connect to ASUS WMI events");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Source thanks to https://github.com/vddCore/Starlight with some adjustments from me
|
||||
|
||||
using Starlight.Communication;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Globalization;
|
||||
using System.Management;
|
||||
using System.Text;
|
||||
|
||||
namespace Starlight.AnimeMatrix
|
||||
{
|
||||
@@ -57,6 +58,14 @@ namespace Starlight.AnimeMatrix
|
||||
}
|
||||
}
|
||||
|
||||
public enum AnimeType
|
||||
{
|
||||
GA401,
|
||||
GA402
|
||||
}
|
||||
|
||||
|
||||
|
||||
public enum BrightnessMode : byte
|
||||
{
|
||||
Off = 0,
|
||||
@@ -68,35 +77,44 @@ namespace Starlight.AnimeMatrix
|
||||
|
||||
public class AnimeMatrixDevice : Device
|
||||
{
|
||||
private const int UpdatePageLength = 0x0278;
|
||||
int UpdatePageLength = 490;
|
||||
int LedCount = 1450;
|
||||
|
||||
public int LedCount => 1450;
|
||||
byte[] _displayBuffer;
|
||||
List<byte[]> frames = new List<byte[]>();
|
||||
|
||||
private byte[] _displayBuffer = new byte[UpdatePageLength * 3];
|
||||
private List<byte[]> frames = new List<byte[]>();
|
||||
|
||||
private int pages = 3;
|
||||
|
||||
public int MaxColumns = 34;
|
||||
public int MaxRows = 61;
|
||||
//public int FullRows = 11;
|
||||
//public int FullEvenRows = -1;
|
||||
|
||||
public int FullRows = 11;
|
||||
public int dx = 0;
|
||||
public int MaxColumns = 34;
|
||||
|
||||
private int frameIndex = 0;
|
||||
|
||||
private static AnimeType _model = AnimeType.GA402;
|
||||
|
||||
public AnimeMatrixDevice()
|
||||
: base(0x0B05, 0x193B, 640)
|
||||
{
|
||||
string model = GetModel();
|
||||
Debug.WriteLine(model);
|
||||
if (model is not null && model.Contains("401"))
|
||||
if (model.Contains("401"))
|
||||
{
|
||||
pages = 2;
|
||||
|
||||
FullRows = 6;
|
||||
_model = AnimeType.GA401;
|
||||
|
||||
MaxColumns = 33;
|
||||
dx = 1;
|
||||
|
||||
MaxRows = 55;
|
||||
LedCount = 1245;
|
||||
|
||||
UpdatePageLength = 410;
|
||||
}
|
||||
|
||||
|
||||
_displayBuffer = new byte[LedCount];
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +137,6 @@ namespace Starlight.AnimeMatrix
|
||||
|
||||
public void PresentNextFrame()
|
||||
{
|
||||
//Debug.WriteLine(frameIndex);
|
||||
if (frameIndex >= frames.Count) frameIndex = 0;
|
||||
_displayBuffer = frames[frameIndex];
|
||||
Present();
|
||||
@@ -143,31 +160,75 @@ namespace Starlight.AnimeMatrix
|
||||
}
|
||||
|
||||
|
||||
public int EmptyColumns(int row)
|
||||
public static int FirstX(int y)
|
||||
{
|
||||
return (int)Math.Ceiling(Math.Max(0, row - FullRows) / 2.0);
|
||||
}
|
||||
public int Columns(int row)
|
||||
{
|
||||
EnsureRowInRange(row);
|
||||
return MaxColumns - EmptyColumns(row);
|
||||
}
|
||||
|
||||
public int RowToLinearAddress(int row)
|
||||
{
|
||||
EnsureRowInRange(row);
|
||||
|
||||
var ret = 0;
|
||||
|
||||
if (row > 0)
|
||||
switch (_model)
|
||||
{
|
||||
for (var i = 0; i < row; i++)
|
||||
ret += Columns(i);
|
||||
case AnimeType.GA401:
|
||||
if (y < 5)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (y + 1) / 2 - 3;
|
||||
}
|
||||
default:
|
||||
return (int)Math.Ceiling(Math.Max(0, y - 11) / 2F);
|
||||
}
|
||||
}
|
||||
|
||||
public static int Width(int y)
|
||||
{
|
||||
switch (_model)
|
||||
{
|
||||
case AnimeType.GA401:
|
||||
return 33;
|
||||
default:
|
||||
return 34;
|
||||
}
|
||||
}
|
||||
|
||||
public static int Pitch(int y)
|
||||
{
|
||||
switch (_model)
|
||||
{
|
||||
case AnimeType.GA401:
|
||||
switch (y)
|
||||
{
|
||||
case 0:
|
||||
case 2:
|
||||
case 4:
|
||||
return 33;
|
||||
case 1:
|
||||
case 3:
|
||||
return 35;
|
||||
default:
|
||||
return 36 - y / 2;
|
||||
}
|
||||
default:
|
||||
return Width(y) - FirstX(y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int RowToLinearAddress(int y)
|
||||
{
|
||||
int ret = 0;
|
||||
for (var i = 0; i < y; i++)
|
||||
ret += Pitch(i);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void SetLedPlanar(int x, int y, byte value)
|
||||
{
|
||||
if (!IsRowInRange(y)) return;
|
||||
|
||||
if (x >= FirstX(y) && x < Width(y))
|
||||
SetLedLinear(RowToLinearAddress(y) - FirstX(y) + x + dx, value);
|
||||
}
|
||||
|
||||
public void WakeUp()
|
||||
{
|
||||
Set(Packet<AnimeMatrixPacket>(Encoding.ASCII.GetBytes("ASUS Tech.Inc.")));
|
||||
@@ -175,13 +236,13 @@ namespace Starlight.AnimeMatrix
|
||||
|
||||
public void SetLedLinear(int address, byte value)
|
||||
{
|
||||
EnsureAddressableLed(address);
|
||||
if (!IsAddressableLed(address)) return;
|
||||
_displayBuffer[address] = value;
|
||||
}
|
||||
|
||||
public void SetLedLinearImmediate(int address, byte value)
|
||||
{
|
||||
EnsureAddressableLed(address);
|
||||
if (!IsAddressableLed(address)) return;
|
||||
_displayBuffer[address] = value;
|
||||
|
||||
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
|
||||
@@ -193,14 +254,7 @@ namespace Starlight.AnimeMatrix
|
||||
Set(Packet<AnimeMatrixPacket>(0xC0, 0x03));
|
||||
}
|
||||
|
||||
public void SetLedPlanar(int x, int y, byte value)
|
||||
{
|
||||
EnsureRowInRange(y);
|
||||
var start = RowToLinearAddress(y) - EmptyColumns(y);
|
||||
|
||||
if (x > EmptyColumns(y))
|
||||
SetLedLinear(start + x, value);
|
||||
}
|
||||
|
||||
public void Clear(bool present = false)
|
||||
{
|
||||
@@ -214,26 +268,23 @@ namespace Starlight.AnimeMatrix
|
||||
public void Present()
|
||||
{
|
||||
|
||||
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
|
||||
.AppendData(BitConverter.GetBytes((ushort)(UpdatePageLength * 0 + 1)))
|
||||
.AppendData(BitConverter.GetBytes((ushort)UpdatePageLength))
|
||||
.AppendData(_displayBuffer[(UpdatePageLength * 0)..(UpdatePageLength * 1)])
|
||||
);
|
||||
int page = 0;
|
||||
int start, end;
|
||||
|
||||
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
|
||||
.AppendData(BitConverter.GetBytes((ushort)(UpdatePageLength * 1 + 1)))
|
||||
.AppendData(BitConverter.GetBytes((ushort)UpdatePageLength))
|
||||
.AppendData(_displayBuffer[(UpdatePageLength * 1)..(UpdatePageLength * 2)])
|
||||
);
|
||||
while (page * UpdatePageLength < LedCount)
|
||||
{
|
||||
start = page * UpdatePageLength;
|
||||
end = Math.Min(LedCount, (page + 1) * UpdatePageLength);
|
||||
|
||||
if (pages > 2)
|
||||
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
|
||||
.AppendData(BitConverter.GetBytes((ushort)(UpdatePageLength * 2 + 1)))
|
||||
.AppendData(BitConverter.GetBytes((ushort)(LedCount - UpdatePageLength * 2)))
|
||||
.AppendData(
|
||||
_displayBuffer[(UpdatePageLength * 2)..(UpdatePageLength * 2 + (LedCount - UpdatePageLength * 2))])
|
||||
.AppendData(BitConverter.GetBytes((ushort)(start + 1)))
|
||||
.AppendData(BitConverter.GetBytes((ushort)(end - start)))
|
||||
.AppendData(_displayBuffer[start..end])
|
||||
);
|
||||
|
||||
page++;
|
||||
}
|
||||
|
||||
Set(Packet<AnimeMatrixPacket>(0xC0, 0x03));
|
||||
}
|
||||
|
||||
@@ -270,55 +321,142 @@ namespace Starlight.AnimeMatrix
|
||||
Set(Packet<AnimeMatrixPacket>(0xC5, animation.AsByte));
|
||||
}
|
||||
|
||||
public void GenerateFrame(Image image)
|
||||
|
||||
public void PresentClock()
|
||||
{
|
||||
int second = DateTime.Now.Second;
|
||||
|
||||
if (CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("H"))
|
||||
PresentTextDiagonal(DateTime.Now.ToString("H" + ((second % 2 == 0) ? ":" : " ") + "mm"));
|
||||
else
|
||||
PresentTextDiagonal(DateTime.Now.ToString("h" + ((second % 2 == 0) ? ":" : " ") + "mmtt"));
|
||||
}
|
||||
|
||||
public void PresentText(string text1, string text2 = "")
|
||||
{
|
||||
using (Bitmap bmp = new Bitmap(MaxColumns * 3, MaxRows))
|
||||
{
|
||||
using (Graphics g = Graphics.FromImage(bmp))
|
||||
{
|
||||
g.CompositingQuality = CompositingQuality.HighQuality;
|
||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
|
||||
using (Font font = new Font("Arial", 24F, GraphicsUnit.Pixel))
|
||||
{
|
||||
SizeF textSize = g.MeasureString(text1, font);
|
||||
g.DrawString(text1, font, Brushes.White, (MaxColumns * 3 - textSize.Width) + 3, -3);
|
||||
}
|
||||
|
||||
if (text2.Length > 0)
|
||||
using (Font font = new Font("Arial", 18F, GraphicsUnit.Pixel))
|
||||
{
|
||||
SizeF textSize = g.MeasureString(text2, font);
|
||||
g.DrawString(text2, font, Brushes.White, (MaxColumns * 3 - textSize.Width) + 1, 25);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GenerateFrame(bmp, InterpolationMode.Bicubic);
|
||||
Present();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void GenerateFrame(Image image, InterpolationMode interpolation = InterpolationMode.High)
|
||||
{
|
||||
|
||||
int width = MaxColumns * 3;
|
||||
int width = MaxColumns / 2 * 6;
|
||||
int height = MaxRows;
|
||||
|
||||
int targetWidth = MaxColumns * 2;
|
||||
|
||||
float scale;
|
||||
|
||||
Bitmap canvas = new Bitmap(width, height);
|
||||
|
||||
scale = Math.Min((float)width / (float)image.Width, (float)height / (float)image.Height);
|
||||
|
||||
var graph = Graphics.FromImage(canvas);
|
||||
var scaleWidth = (int)(image.Width * scale);
|
||||
var scaleHeight = (int)(image.Height * scale);
|
||||
|
||||
graph.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
|
||||
graph.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
|
||||
graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
|
||||
|
||||
graph.DrawImage(image, ((int)width - scaleWidth), ((int)height - scaleHeight) / 2, scaleWidth, scaleHeight);
|
||||
|
||||
Bitmap bmp = new Bitmap(canvas, MaxColumns, MaxRows);
|
||||
|
||||
for (int y = 0; y < bmp.Height; y++)
|
||||
using (Bitmap bmp = new Bitmap(targetWidth, height))
|
||||
{
|
||||
for (int x = 0; x < bmp.Width; x++)
|
||||
scale = Math.Min((float)width / (float)image.Width, (float)height / (float)image.Height);
|
||||
|
||||
using (var graph = Graphics.FromImage(bmp))
|
||||
{
|
||||
var pixel = bmp.GetPixel(x, y);
|
||||
byte color = (byte)(Math.Max((pixel.R + pixel.G + pixel.B) / 3 - 10, 0));
|
||||
SetLedPlanar(x, y, color);
|
||||
var scaleWidth = (float)(image.Width * scale);
|
||||
var scaleHeight = (float)(image.Height * scale);
|
||||
|
||||
graph.InterpolationMode = interpolation;
|
||||
graph.CompositingQuality = CompositingQuality.HighQuality;
|
||||
graph.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
|
||||
graph.DrawImage(image, (float)Math.Round(targetWidth - scaleWidth * targetWidth / width), 0, (float)Math.Round(scaleWidth * targetWidth / width), scaleHeight);
|
||||
|
||||
}
|
||||
|
||||
for (int y = 0; y < bmp.Height; y++)
|
||||
{
|
||||
for (int x = 0; x < bmp.Width; x++)
|
||||
if (x % 2 == (y + dx) % 2)
|
||||
{
|
||||
var pixel = bmp.GetPixel(x, y);
|
||||
var color = (pixel.R + pixel.G + pixel.B) / 3;
|
||||
if (color < 10) color = 0;
|
||||
SetLedPlanar(x / 2, y, (byte)color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SetLedDiagonal(int x, int y, byte color, int delta = 10)
|
||||
{
|
||||
//x+=delta;
|
||||
y -= delta;
|
||||
|
||||
int dx = (x - y) / 2;
|
||||
int dy = x + y;
|
||||
SetLedPlanar(dx, dy, color);
|
||||
}
|
||||
|
||||
public void PresentTextDiagonal(string text)
|
||||
{
|
||||
|
||||
Clear();
|
||||
|
||||
int maxX = (int)Math.Sqrt(MaxRows * MaxRows + MaxColumns * MaxColumns);
|
||||
|
||||
using (Bitmap bmp = new Bitmap(maxX, MaxRows))
|
||||
{
|
||||
using (Graphics g = Graphics.FromImage(bmp))
|
||||
{
|
||||
g.CompositingQuality = CompositingQuality.HighQuality;
|
||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
|
||||
using (Font font = new Font("Calibri", 14F, GraphicsUnit.Pixel))
|
||||
{
|
||||
SizeF textSize = g.MeasureString(text, font);
|
||||
g.DrawString(text, font, Brushes.White, 4, 0);
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = 0; y < bmp.Height; y++)
|
||||
{
|
||||
for (int x = 0; x < bmp.Width; x++)
|
||||
{
|
||||
var pixel = bmp.GetPixel(x, y);
|
||||
var color = (pixel.R + pixel.G + pixel.B) / 3;
|
||||
SetLedDiagonal(x, y, (byte)color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Present();
|
||||
}
|
||||
|
||||
private void EnsureRowInRange(int row)
|
||||
private bool IsRowInRange(int row)
|
||||
{
|
||||
if (row < 0 || row >= MaxRows)
|
||||
{
|
||||
throw new IndexOutOfRangeException($"Y-coordinate should fall in range of [0, {MaxRows - 1}].");
|
||||
}
|
||||
return (row >= 0 && row < MaxRows);
|
||||
}
|
||||
|
||||
private void EnsureAddressableLed(int address)
|
||||
private bool IsAddressableLed(int address)
|
||||
{
|
||||
if (address < 0 || address >= LedCount)
|
||||
{
|
||||
throw new IndexOutOfRangeException($"Linear LED address must be in range of [0, {LedCount - 1}].");
|
||||
}
|
||||
return (address >= 0 && address < LedCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Text.Json;
|
||||
using System.Diagnostics;
|
||||
using System.Management;
|
||||
using System.Text.Json;
|
||||
|
||||
public class AppConfig
|
||||
{
|
||||
@@ -6,6 +8,8 @@ public class AppConfig
|
||||
public string appPath;
|
||||
string configFile;
|
||||
|
||||
string _model;
|
||||
|
||||
public Dictionary<string, object> config = new Dictionary<string, object>();
|
||||
|
||||
public AppConfig()
|
||||
@@ -36,6 +40,31 @@ public class AppConfig
|
||||
|
||||
}
|
||||
|
||||
|
||||
public string GetModel()
|
||||
{
|
||||
if (_model is null)
|
||||
{
|
||||
_model = "";
|
||||
using (var searcher = new ManagementObjectSearcher(@"Select * from Win32_ComputerSystem"))
|
||||
{
|
||||
foreach (var process in searcher.Get())
|
||||
{
|
||||
_model = process["Model"].ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _model;
|
||||
}
|
||||
public bool ContainsModel(string contains)
|
||||
{
|
||||
|
||||
GetModel();
|
||||
return (_model is not null && _model.Contains(contains));
|
||||
|
||||
}
|
||||
private void initConfig()
|
||||
{
|
||||
config = new Dictionary<string, object>();
|
||||
@@ -63,14 +92,27 @@ public class AppConfig
|
||||
{
|
||||
config[name] = value;
|
||||
string jsonString = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true });
|
||||
File.WriteAllText(configFile, jsonString);
|
||||
try
|
||||
{
|
||||
File.WriteAllText(configFile, jsonString);
|
||||
} catch (Exception e)
|
||||
{
|
||||
Debug.Write(e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void setConfig(string name, string value)
|
||||
{
|
||||
config[name] = value;
|
||||
string jsonString = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true });
|
||||
File.WriteAllText(configFile, jsonString);
|
||||
try
|
||||
{
|
||||
File.WriteAllText(configFile, jsonString);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Write(e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public string getParamName(int device, string paramName = "fan_profile")
|
||||
@@ -80,6 +122,8 @@ public class AppConfig
|
||||
|
||||
if (device == 1)
|
||||
name = "gpu";
|
||||
else if (device == 2)
|
||||
name = "mid";
|
||||
else
|
||||
name = "cpu";
|
||||
|
||||
@@ -142,6 +186,12 @@ public class AppConfig
|
||||
return curve;
|
||||
}
|
||||
|
||||
public string getConfigPerfString(string name)
|
||||
{
|
||||
int mode = getConfig("performance_mode");
|
||||
return getConfigString(name + "_" + mode);
|
||||
}
|
||||
|
||||
public int getConfigPerf(string name)
|
||||
{
|
||||
int mode = getConfig("performance_mode");
|
||||
|
||||
342
app/Aura.cs
342
app/Aura.cs
@@ -1,78 +1,300 @@
|
||||
using HidLibrary;
|
||||
using System.Diagnostics;
|
||||
using static Starlight.AnimeMatrix.BuiltInAnimation;
|
||||
|
||||
public class Aura
|
||||
namespace GHelper
|
||||
{
|
||||
|
||||
static byte[] MESSAGE_SET = { 0x5d, 0xb5, 0,0,0 };
|
||||
static byte[] MESSAGE_APPLY = { 0x5d, 0xb4};
|
||||
|
||||
public const int Static = 0;
|
||||
public const int Breathe = 1;
|
||||
public const int Strobe = 2;
|
||||
public const int Rainbow = 3;
|
||||
public const int Dingding = 4;
|
||||
|
||||
public const int SpeedSlow = 0xe1;
|
||||
public const int SpeedMedium = 0xeb;
|
||||
public const int SpeedHigh = 0xf5;
|
||||
|
||||
public static int Mode = Static;
|
||||
public static Color Color1 = Color.White;
|
||||
public static Color Color2 = Color.Black;
|
||||
public static int Speed = SpeedSlow;
|
||||
|
||||
public static byte[] AuraMessage(int mode, Color color, Color color2, int speed)
|
||||
[Flags]
|
||||
public enum AuraDev19b6 : uint
|
||||
{
|
||||
byte[] msg = new byte[17];
|
||||
msg[0] = 0x5d;
|
||||
msg[1] = 0xb3;
|
||||
msg[2] = 0x00; // Zone
|
||||
msg[3] = (byte)mode; // Aura Mode
|
||||
msg[4] = (byte)(color.R); // R
|
||||
msg[5] = (byte)(color.G); // G
|
||||
msg[6] = (byte)(color.B); // B
|
||||
msg[7] = (byte)speed; // aura.speed as u8;
|
||||
msg[8] = 0; // aura.direction as u8;
|
||||
msg[10] = (byte)(color2.R); // R
|
||||
msg[11] = (byte)(color2.G); // G
|
||||
msg[12] = (byte)(color2.B); // B
|
||||
return msg;
|
||||
BootLogo = 1,
|
||||
BootKeyb = 1 << 1,
|
||||
AwakeLogo = 1 << 2,
|
||||
AwakeKeyb = 1 << 3,
|
||||
SleepLogo = 1 << 4,
|
||||
SleepKeyb = 1 << 5,
|
||||
ShutdownLogo = 1 << 6,
|
||||
ShutdownKeyb = 1 << 7,
|
||||
BootBar = 1u << (7 + 2),
|
||||
AwakeBar = 1u << (7 + 3),
|
||||
SleepBar = 1u << (7 + 4),
|
||||
ShutdownBar = 1u << (7 + 5),
|
||||
BootLid = 1u << (15 + 1),
|
||||
AwakeLid = 1u << (15 + 2),
|
||||
SleepLid = 1u << (15 + 3),
|
||||
ShutdownLid = 1u << (15 + 4)
|
||||
}
|
||||
|
||||
public static void ApplyAura()
|
||||
public static class AuraDev19b6Extensions
|
||||
{
|
||||
public static byte[] ToBytes(this AuraDev19b6[] controls)
|
||||
{
|
||||
uint a = 0;
|
||||
foreach (var n in controls)
|
||||
{
|
||||
a |= (uint)n;
|
||||
}
|
||||
return new byte[] { 0x5d, 0xbd, 0x01, (byte)(a & 0xff), (byte)((a & 0xff00) >> 8), (byte)((a & 0xff0000) >> 16) };
|
||||
}
|
||||
|
||||
public static ushort BitOr(this AuraDev19b6 self, AuraDev19b6 rhs)
|
||||
{
|
||||
return (ushort)(self | rhs);
|
||||
}
|
||||
|
||||
public static ushort BitAnd(this AuraDev19b6 self, AuraDev19b6 rhs)
|
||||
{
|
||||
return (ushort)(self & rhs);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Aura
|
||||
{
|
||||
|
||||
HidDevice[] HidDeviceList;
|
||||
int[] deviceIds = { 0x1854, 0x1869, 0x1866, 0x19b6, 0x1822, 0x1837, 0x1854, 0x184a, 0x183d, 0x8502, 0x1807, 0x17e0 };
|
||||
static byte[] MESSAGE_SET = { 0x5d, 0xb5, 0, 0, 0 };
|
||||
static byte[] MESSAGE_APPLY = { 0x5d, 0xb4 };
|
||||
|
||||
HidDeviceList = HidDevices.Enumerate(0x0b05, deviceIds).ToArray();
|
||||
static int[] deviceIds = { 0x1a30, 0x1854, 0x1869, 0x1866, 0x19b6, 0x1822, 0x1837, 0x1854, 0x184a, 0x183d, 0x8502, 0x1807, 0x17e0 };
|
||||
|
||||
if (Mode == Dingding)
|
||||
{
|
||||
Mode = 10;
|
||||
Speed = SpeedMedium;
|
||||
}
|
||||
else if (Mode == Rainbow)
|
||||
{
|
||||
Speed = SpeedMedium;
|
||||
}
|
||||
else
|
||||
{
|
||||
Speed = SpeedSlow;
|
||||
}
|
||||
private static int mode = 0;
|
||||
private static int speed = 1;
|
||||
public static Color Color1 = Color.White;
|
||||
public static Color Color2 = Color.Black;
|
||||
|
||||
foreach (HidDevice device in HidDeviceList)
|
||||
|
||||
public static Dictionary<int, string> GetSpeeds()
|
||||
{
|
||||
if (device.IsConnected && device.Description.Contains("HID"))
|
||||
return new Dictionary<int, string>
|
||||
{
|
||||
device.OpenDevice();
|
||||
byte[] msg = AuraMessage(Mode, Color1, Color2, Speed);
|
||||
device.Write(msg);
|
||||
device.Write(MESSAGE_SET);
|
||||
device.Write(MESSAGE_APPLY);
|
||||
device.CloseDevice();
|
||||
{ 0, Properties.Strings.AuraSlow },
|
||||
{ 1, Properties.Strings.AuraNormal },
|
||||
{ 2, Properties.Strings.AuraFast }
|
||||
};
|
||||
}
|
||||
|
||||
static Dictionary<int, string> _modes = new Dictionary<int, string>
|
||||
{
|
||||
{ 0, Properties.Strings.AuraStatic },
|
||||
{ 1, Properties.Strings.AuraBreathe },
|
||||
{ 2, Properties.Strings.AuraColorCycle },
|
||||
{ 3, Properties.Strings.AuraRainbow },
|
||||
{ 10, Properties.Strings.AuraStrobe },
|
||||
};
|
||||
|
||||
static Dictionary<int, string> _modesStrix = new Dictionary<int, string>
|
||||
{
|
||||
{ 0, Properties.Strings.AuraStatic },
|
||||
{ 1, Properties.Strings.AuraBreathe },
|
||||
{ 2, Properties.Strings.AuraColorCycle },
|
||||
{ 3, Properties.Strings.AuraRainbow },
|
||||
{ 4, "Star" },
|
||||
{ 5, "Rain" },
|
||||
{ 6, "Highlight" },
|
||||
{ 7, "Laser" },
|
||||
{ 8, "Ripple" },
|
||||
{ 10, Properties.Strings.AuraStrobe},
|
||||
{ 11, "Comet" },
|
||||
{ 12, "Flash" },
|
||||
};
|
||||
|
||||
|
||||
public static Dictionary<int, string> GetModes()
|
||||
{
|
||||
if (Program.config.ContainsModel("TUF"))
|
||||
{
|
||||
_modes.Remove(3);
|
||||
}
|
||||
|
||||
if (Program.config.ContainsModel("401"))
|
||||
{
|
||||
_modes.Remove(2);
|
||||
_modes.Remove(3);
|
||||
}
|
||||
|
||||
if (Program.config.ContainsModel("Strix") || Program.config.ContainsModel("Scar"))
|
||||
{
|
||||
return _modesStrix;
|
||||
}
|
||||
|
||||
return _modes;
|
||||
}
|
||||
|
||||
|
||||
public static int Mode
|
||||
{
|
||||
get { return mode; }
|
||||
set
|
||||
{
|
||||
if (GetModes().ContainsKey(value))
|
||||
mode = value;
|
||||
else
|
||||
mode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool HasSecondColor()
|
||||
{
|
||||
return (mode == 1 && !Program.config.ContainsModel("TUF"));
|
||||
}
|
||||
|
||||
public static int Speed
|
||||
{
|
||||
get { return speed; }
|
||||
set
|
||||
{
|
||||
if (GetSpeeds().ContainsKey(value))
|
||||
speed = value;
|
||||
else
|
||||
speed = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void SetColor(int colorCode)
|
||||
{
|
||||
Color1 = Color.FromArgb(colorCode);
|
||||
}
|
||||
|
||||
public static void SetColor2(int colorCode)
|
||||
{
|
||||
Color2 = Color.FromArgb(colorCode);
|
||||
}
|
||||
|
||||
public static byte[] AuraMessage(int mode, Color color, Color color2, int speed)
|
||||
{
|
||||
|
||||
byte[] msg = new byte[17];
|
||||
msg[0] = 0x5d;
|
||||
msg[1] = 0xb3;
|
||||
msg[2] = 0x00; // Zone
|
||||
msg[3] = (byte)mode; // Aura Mode
|
||||
msg[4] = (byte)(color.R); // R
|
||||
msg[5] = (byte)(color.G); // G
|
||||
msg[6] = (byte)(color.B); // B
|
||||
msg[7] = (byte)speed; // aura.speed as u8;
|
||||
msg[8] = 0; // aura.direction as u8;
|
||||
msg[10] = (byte)(color2.R); // R
|
||||
msg[11] = (byte)(color2.G); // G
|
||||
msg[12] = (byte)(color2.B); // B
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
public static void ApplyBrightness(int brightness)
|
||||
{
|
||||
HidDevice[] HidDeviceList = HidDevices.Enumerate(0x0b05, deviceIds).ToArray();
|
||||
|
||||
byte[] msg = { 0x5d, 0xba, 0xc5, 0xc4, (byte)brightness };
|
||||
|
||||
foreach (HidDevice device in HidDeviceList)
|
||||
if (device.IsConnected && device.Description.Contains("HID"))
|
||||
{
|
||||
device.OpenDevice();
|
||||
device.Write(msg);
|
||||
device.CloseDevice();
|
||||
}
|
||||
|
||||
Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
|
||||
|
||||
if (Program.config.ContainsModel("TUF"))
|
||||
Program.wmi.TUFKeyboardBrightness(brightness);
|
||||
}
|
||||
|
||||
|
||||
public static void ApplyAuraPower(bool awake = true, bool boot = false, bool sleep = false, bool shutdown = false)
|
||||
{
|
||||
HidDevice[] HidDeviceList = HidDevices.Enumerate(0x0b05, 0x19b6).ToArray();
|
||||
|
||||
List<AuraDev19b6> flags = new List<AuraDev19b6>();
|
||||
|
||||
if (awake)
|
||||
{
|
||||
flags.Add(AuraDev19b6.AwakeKeyb);
|
||||
flags.Add(AuraDev19b6.AwakeBar);
|
||||
flags.Add(AuraDev19b6.AwakeLid);
|
||||
flags.Add(AuraDev19b6.AwakeLogo);
|
||||
}
|
||||
|
||||
if (boot)
|
||||
{
|
||||
flags.Add(AuraDev19b6.BootKeyb);
|
||||
flags.Add(AuraDev19b6.BootBar);
|
||||
flags.Add(AuraDev19b6.BootLid);
|
||||
flags.Add(AuraDev19b6.BootLogo);
|
||||
}
|
||||
|
||||
if (sleep)
|
||||
{
|
||||
flags.Add(AuraDev19b6.SleepKeyb);
|
||||
flags.Add(AuraDev19b6.SleepBar);
|
||||
flags.Add(AuraDev19b6.SleepLid);
|
||||
flags.Add(AuraDev19b6.SleepLogo);
|
||||
}
|
||||
|
||||
if (shutdown)
|
||||
{
|
||||
flags.Add(AuraDev19b6.ShutdownKeyb);
|
||||
flags.Add(AuraDev19b6.ShutdownBar);
|
||||
flags.Add(AuraDev19b6.ShutdownLid);
|
||||
flags.Add(AuraDev19b6.ShutdownLogo);
|
||||
}
|
||||
|
||||
byte[] msg = AuraDev19b6Extensions.ToBytes(flags.ToArray());
|
||||
|
||||
Debug.WriteLine(BitConverter.ToString(msg));
|
||||
|
||||
foreach (HidDevice device in HidDeviceList)
|
||||
if (device.IsConnected && device.Description.Contains("HID"))
|
||||
{
|
||||
device.OpenDevice();
|
||||
device.Write(msg);
|
||||
device.CloseDevice();
|
||||
}
|
||||
|
||||
Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
|
||||
|
||||
if (Program.config.ContainsModel("TUF"))
|
||||
Program.wmi.TUFKeyboardPower(awake, boot, sleep, shutdown);
|
||||
|
||||
}
|
||||
|
||||
public static void ApplyAura()
|
||||
{
|
||||
|
||||
HidDevice[] HidDeviceList = HidDevices.Enumerate(0x0b05, deviceIds).ToArray();
|
||||
|
||||
int _speed;
|
||||
|
||||
switch (Speed)
|
||||
{
|
||||
case 1:
|
||||
_speed = 0xeb;
|
||||
break;
|
||||
case 2:
|
||||
_speed = 0xf5;
|
||||
break;
|
||||
default:
|
||||
_speed = 0xe1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
byte[] msg = AuraMessage(Mode, Color1, Color2, _speed);
|
||||
foreach (HidDevice device in HidDeviceList)
|
||||
if (device.IsConnected && device.Description.Contains("HID"))
|
||||
{
|
||||
device.OpenDevice();
|
||||
device.Write(msg);
|
||||
device.Write(MESSAGE_SET);
|
||||
device.Write(MESSAGE_APPLY);
|
||||
device.CloseDevice();
|
||||
}
|
||||
|
||||
if (Program.config.ContainsModel("TUF"))
|
||||
Program.wmi.TUFKeyboardRGB(Mode, Color1, _speed);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
170
app/ControlHelper.cs
Normal file
170
app/ControlHelper.cs
Normal file
@@ -0,0 +1,170 @@
|
||||
using CustomControls;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
using WinFormsSliderBar;
|
||||
|
||||
public static class ControlHelper
|
||||
{
|
||||
|
||||
static bool _invert = false;
|
||||
static float _scale = 1;
|
||||
|
||||
public static void Adjust(RForm container, bool invert = false)
|
||||
{
|
||||
|
||||
container.BackColor = RForm.formBack;
|
||||
container.ForeColor = RForm.foreMain;
|
||||
|
||||
_invert = invert;
|
||||
AdjustControls(container.Controls);
|
||||
_invert = false;
|
||||
|
||||
}
|
||||
|
||||
public static void Resize(RForm container, float baseScale = 2)
|
||||
{
|
||||
_scale = GetDpiScale(container).Value / baseScale;
|
||||
if (Math.Abs(_scale - 1) > 0.2) ResizeControls(container.Controls);
|
||||
|
||||
}
|
||||
|
||||
private static void ResizeControls(Control.ControlCollection controls)
|
||||
{
|
||||
foreach (Control control in controls)
|
||||
{
|
||||
var button = control as RButton;
|
||||
if (button != null && button.Image is not null)
|
||||
button.Image = ResizeImage(button.Image);
|
||||
|
||||
/*
|
||||
var pictureBox = control as PictureBox;
|
||||
if (pictureBox != null && pictureBox.BackgroundImage is not null)
|
||||
pictureBox.BackgroundImage = ResizeImage(pictureBox.BackgroundImage);
|
||||
*/
|
||||
|
||||
ResizeControls(control.Controls);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void AdjustControls(Control.ControlCollection controls)
|
||||
{
|
||||
foreach (Control control in controls)
|
||||
{
|
||||
var button = control as RButton;
|
||||
if (button != null)
|
||||
{
|
||||
button.BackColor = button.Secondary ? RForm.buttonSecond : RForm.buttonMain;
|
||||
button.ForeColor = RForm.foreMain;
|
||||
|
||||
button.FlatStyle = FlatStyle.Flat;
|
||||
button.FlatAppearance.BorderColor = RForm.borderMain;
|
||||
|
||||
if (button.Image is not null)
|
||||
button.Image = AdjustImage(button.Image);
|
||||
}
|
||||
|
||||
var pictureBox = control as PictureBox;
|
||||
if (pictureBox != null && pictureBox.BackgroundImage is not null)
|
||||
pictureBox.BackgroundImage = AdjustImage(pictureBox.BackgroundImage);
|
||||
|
||||
|
||||
var combo = control as RComboBox;
|
||||
if (combo != null)
|
||||
{
|
||||
combo.BackColor = RForm.buttonMain;
|
||||
combo.ForeColor = RForm.foreMain;
|
||||
combo.BorderColor = RForm.buttonMain;
|
||||
combo.ButtonColor = RForm.buttonMain;
|
||||
combo.ArrowColor = RForm.foreMain;
|
||||
}
|
||||
|
||||
var gb = control as GroupBox;
|
||||
if (gb != null)
|
||||
{
|
||||
gb.ForeColor = RForm.foreMain;
|
||||
}
|
||||
|
||||
var sl = control as Slider;
|
||||
if (sl != null)
|
||||
{
|
||||
sl.borderColor = RForm.buttonMain;
|
||||
}
|
||||
|
||||
var chk = control as CheckBox;
|
||||
if (chk != null && chk.Padding.Left > 5)
|
||||
{
|
||||
chk.BackColor = RForm.buttonSecond;
|
||||
}
|
||||
|
||||
var chart = control as Chart;
|
||||
if (chart != null)
|
||||
{
|
||||
chart.BackColor = RForm.chartMain;
|
||||
chart.ChartAreas[0].BackColor = RForm.chartMain;
|
||||
|
||||
chart.ChartAreas[0].AxisX.TitleForeColor = RForm.foreMain;
|
||||
chart.ChartAreas[0].AxisY.TitleForeColor = RForm.foreMain;
|
||||
|
||||
chart.ChartAreas[0].AxisX.LabelStyle.ForeColor = RForm.foreMain;
|
||||
chart.ChartAreas[0].AxisY.LabelStyle.ForeColor = RForm.foreMain;
|
||||
|
||||
chart.ChartAreas[0].AxisX.MajorTickMark.LineColor = RForm.foreMain;
|
||||
chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = RForm.foreMain;
|
||||
|
||||
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = RForm.chartGrid;
|
||||
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = RForm.chartGrid;
|
||||
chart.ChartAreas[0].AxisX.LineColor = RForm.chartGrid;
|
||||
chart.ChartAreas[0].AxisY.LineColor = RForm.chartGrid;
|
||||
|
||||
chart.Titles[0].ForeColor = RForm.foreMain;
|
||||
|
||||
}
|
||||
|
||||
AdjustControls(control.Controls);
|
||||
}
|
||||
}
|
||||
|
||||
public static Lazy<float> GetDpiScale(Control control)
|
||||
{
|
||||
return new Lazy<float>(() =>
|
||||
{
|
||||
using (var graphics = control.CreateGraphics())
|
||||
return graphics.DpiX / 96.0f;
|
||||
});
|
||||
}
|
||||
|
||||
private static Image ResizeImage(Image image)
|
||||
{
|
||||
var newSize = new Size((int)(image.Width * _scale), (int)(image.Height * _scale));
|
||||
var pic = new Bitmap(newSize.Width, newSize.Height);
|
||||
|
||||
using (var g = Graphics.FromImage(pic))
|
||||
{
|
||||
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
g.DrawImage(image, new Rectangle(new Point(), newSize));
|
||||
}
|
||||
return pic;
|
||||
}
|
||||
|
||||
private static Image AdjustImage(Image image)
|
||||
{
|
||||
var pic = new Bitmap(image);
|
||||
|
||||
if (_invert)
|
||||
{
|
||||
for (int y = 0; (y <= (pic.Height - 1)); y++)
|
||||
{
|
||||
for (int x = 0; (x <= (pic.Width - 1)); x++)
|
||||
{
|
||||
Color col = pic.GetPixel(x, y);
|
||||
pic.SetPixel(x, y, Color.FromArgb(col.A, (255 - col.R), (255 - col.G), (255 - col.B)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pic;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
35
app/CustomContextMenu.cs
Normal file
35
app/CustomContextMenu.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
class CustomContextMenu : ContextMenuStrip
|
||||
{
|
||||
[DllImport("dwmapi.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
private static extern long DwmSetWindowAttribute(IntPtr hwnd,
|
||||
DWMWINDOWATTRIBUTE attribute,
|
||||
ref DWM_WINDOW_CORNER_PREFERENCE pvAttribute,
|
||||
uint cbAttribute);
|
||||
|
||||
public CustomContextMenu()
|
||||
{
|
||||
var preference = DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUNDSMALL; //change as you want
|
||||
DwmSetWindowAttribute(Handle,
|
||||
DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE,
|
||||
ref preference,
|
||||
sizeof(uint));
|
||||
}
|
||||
|
||||
public enum DWMWINDOWATTRIBUTE
|
||||
{
|
||||
DWMWA_WINDOW_CORNER_PREFERENCE = 33
|
||||
}
|
||||
public enum DWM_WINDOW_CORNER_PREFERENCE
|
||||
{
|
||||
DWMWA_DEFAULT = 0,
|
||||
DWMWCP_DONOTROUND = 1,
|
||||
DWMWCP_ROUND = 2,
|
||||
DWMWCP_ROUNDSMALL = 3,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
401
app/CustomControls.cs
Normal file
401
app/CustomControls.cs
Normal file
@@ -0,0 +1,401 @@
|
||||
using Microsoft.Win32;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CustomControls
|
||||
{
|
||||
|
||||
public class RForm : Form
|
||||
{
|
||||
|
||||
public static Color colorEco = Color.FromArgb(255, 6, 180, 138);
|
||||
public static Color colorStandard = Color.FromArgb(255, 58, 174, 239);
|
||||
public static Color colorTurbo = Color.FromArgb(255, 255, 32, 32);
|
||||
|
||||
public static Color buttonMain;
|
||||
public static Color buttonSecond;
|
||||
|
||||
public static Color formBack;
|
||||
public static Color foreMain;
|
||||
public static Color borderMain;
|
||||
public static Color chartMain;
|
||||
public static Color chartGrid;
|
||||
|
||||
[DllImport("UXTheme.dll", SetLastError = true, EntryPoint = "#138")]
|
||||
public static extern bool CheckSystemDarkModeStatus();
|
||||
|
||||
[DllImport("DwmApi")] //System.Runtime.InteropServices
|
||||
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize);
|
||||
|
||||
public bool darkTheme = false;
|
||||
|
||||
public RForm()
|
||||
{
|
||||
DoubleBuffered = true;
|
||||
}
|
||||
|
||||
public static void InitColors(bool darkTheme)
|
||||
{
|
||||
if (darkTheme)
|
||||
{
|
||||
buttonMain = Color.FromArgb(255, 55, 55, 55);
|
||||
buttonSecond = Color.FromArgb(255, 38, 38, 38);
|
||||
|
||||
formBack = Color.FromArgb(255, 28, 28, 28);
|
||||
foreMain = Color.FromArgb(255, 240, 240, 240);
|
||||
borderMain = Color.FromArgb(255, 50, 50, 50);
|
||||
|
||||
chartMain = Color.FromArgb(255, 35, 35, 35);
|
||||
chartGrid = Color.FromArgb(255, 70, 70, 70);
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonMain = SystemColors.ControlLightLight;
|
||||
buttonSecond = SystemColors.ControlLight;
|
||||
|
||||
formBack = SystemColors.Control;
|
||||
foreMain = SystemColors.ControlText;
|
||||
borderMain = Color.LightGray;
|
||||
|
||||
chartMain = SystemColors.ControlLightLight;
|
||||
chartGrid = Color.LightGray;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsDarkTheme()
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
|
||||
var registryValueObject = key?.GetValue("AppsUseLightTheme");
|
||||
|
||||
if (registryValueObject == null) return false;
|
||||
return (int)registryValueObject <= 0;
|
||||
}
|
||||
|
||||
public bool InitTheme(bool setDPI = false)
|
||||
{
|
||||
bool newDarkTheme = CheckSystemDarkModeStatus();
|
||||
bool changed = (darkTheme != newDarkTheme);
|
||||
darkTheme = newDarkTheme;
|
||||
|
||||
InitColors(darkTheme);
|
||||
|
||||
if (setDPI)
|
||||
ControlHelper.Resize(this);
|
||||
|
||||
if (changed)
|
||||
{
|
||||
DwmSetWindowAttribute(this.Handle, 20, new[] { darkTheme ? 1 : 0 }, 4);
|
||||
ControlHelper.Adjust(this, changed);
|
||||
}
|
||||
|
||||
return changed;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class RCheckBox : CheckBox
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class RComboBox : ComboBox
|
||||
{
|
||||
private Color borderColor = Color.Gray;
|
||||
[DefaultValue(typeof(Color), "Gray")]
|
||||
public Color BorderColor
|
||||
{
|
||||
get { return borderColor; }
|
||||
set
|
||||
{
|
||||
if (borderColor != value)
|
||||
{
|
||||
borderColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Color buttonColor = Color.FromArgb(255, 255, 255, 255);
|
||||
[DefaultValue(typeof(Color), "255, 255, 255")]
|
||||
public Color ButtonColor
|
||||
{
|
||||
get { return buttonColor; }
|
||||
set
|
||||
{
|
||||
if (buttonColor != value)
|
||||
{
|
||||
buttonColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Color arrowColor = Color.Black;
|
||||
[DefaultValue(typeof(Color), "Black")]
|
||||
public Color ArrowColor
|
||||
{
|
||||
get { return arrowColor; }
|
||||
set
|
||||
{
|
||||
if (arrowColor != value)
|
||||
{
|
||||
arrowColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
if (m.Msg == WM_PAINT && DropDownStyle != ComboBoxStyle.Simple)
|
||||
{
|
||||
var clientRect = ClientRectangle;
|
||||
var dropDownButtonWidth = SystemInformation.HorizontalScrollBarArrowWidth;
|
||||
var outerBorder = new Rectangle(clientRect.Location,
|
||||
new Size(clientRect.Width - 1, clientRect.Height - 1));
|
||||
var innerBorder = new Rectangle(outerBorder.X + 1, outerBorder.Y + 1,
|
||||
outerBorder.Width - dropDownButtonWidth - 2, outerBorder.Height - 2);
|
||||
var innerInnerBorder = new Rectangle(innerBorder.X + 1, innerBorder.Y + 1,
|
||||
innerBorder.Width - 2, innerBorder.Height - 2);
|
||||
var dropDownRect = new Rectangle(innerBorder.Right + 1, innerBorder.Y,
|
||||
dropDownButtonWidth, innerBorder.Height + 1);
|
||||
if (RightToLeft == RightToLeft.Yes)
|
||||
{
|
||||
innerBorder.X = clientRect.Width - innerBorder.Right;
|
||||
innerInnerBorder.X = clientRect.Width - innerInnerBorder.Right;
|
||||
dropDownRect.X = clientRect.Width - dropDownRect.Right;
|
||||
dropDownRect.Width += 1;
|
||||
}
|
||||
var innerBorderColor = Enabled ? BackColor : SystemColors.Control;
|
||||
var outerBorderColor = Enabled ? BorderColor : SystemColors.ControlDark;
|
||||
var buttonColor = Enabled ? ButtonColor : SystemColors.Control;
|
||||
var middle = new Point(dropDownRect.Left + dropDownRect.Width / 2,
|
||||
dropDownRect.Top + dropDownRect.Height / 2);
|
||||
var arrow = new Point[]
|
||||
{
|
||||
new Point(middle.X - 3, middle.Y - 2),
|
||||
new Point(middle.X + 4, middle.Y - 2),
|
||||
new Point(middle.X, middle.Y + 2)
|
||||
};
|
||||
var ps = new PAINTSTRUCT();
|
||||
bool shoulEndPaint = false;
|
||||
IntPtr dc;
|
||||
if (m.WParam == IntPtr.Zero)
|
||||
{
|
||||
dc = BeginPaint(Handle, ref ps);
|
||||
m.WParam = dc;
|
||||
shoulEndPaint = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
dc = m.WParam;
|
||||
}
|
||||
|
||||
var rgn = CreateRectRgn(innerInnerBorder.Left, innerInnerBorder.Top,
|
||||
innerInnerBorder.Right, innerInnerBorder.Bottom);
|
||||
|
||||
SelectClipRgn(dc, rgn);
|
||||
DefWndProc(ref m);
|
||||
DeleteObject(rgn);
|
||||
rgn = CreateRectRgn(clientRect.Left, clientRect.Top,
|
||||
clientRect.Right, clientRect.Bottom);
|
||||
SelectClipRgn(dc, rgn);
|
||||
using (var g = Graphics.FromHdc(dc))
|
||||
{
|
||||
using (var b = new SolidBrush(buttonColor))
|
||||
{
|
||||
g.FillRectangle(b, dropDownRect);
|
||||
}
|
||||
using (var b = new SolidBrush(arrowColor))
|
||||
{
|
||||
g.FillPolygon(b, arrow);
|
||||
}
|
||||
using (var p = new Pen(innerBorderColor))
|
||||
{
|
||||
g.DrawRectangle(p, innerBorder);
|
||||
g.DrawRectangle(p, innerInnerBorder);
|
||||
}
|
||||
using (var p = new Pen(outerBorderColor))
|
||||
{
|
||||
g.DrawRectangle(p, outerBorder);
|
||||
}
|
||||
}
|
||||
if (shoulEndPaint)
|
||||
EndPaint(Handle, ref ps);
|
||||
DeleteObject(rgn);
|
||||
}
|
||||
else
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
|
||||
private const int WM_PAINT = 0xF;
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct RECT
|
||||
{
|
||||
public int L, T, R, B;
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct PAINTSTRUCT
|
||||
{
|
||||
public IntPtr hdc;
|
||||
public bool fErase;
|
||||
public int rcPaint_left;
|
||||
public int rcPaint_top;
|
||||
public int rcPaint_right;
|
||||
public int rcPaint_bottom;
|
||||
public bool fRestore;
|
||||
public bool fIncUpdate;
|
||||
public int reserved1;
|
||||
public int reserved2;
|
||||
public int reserved3;
|
||||
public int reserved4;
|
||||
public int reserved5;
|
||||
public int reserved6;
|
||||
public int reserved7;
|
||||
public int reserved8;
|
||||
}
|
||||
[DllImport("user32.dll")]
|
||||
private static extern IntPtr BeginPaint(IntPtr hWnd,
|
||||
[In, Out] ref PAINTSTRUCT lpPaint);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool EndPaint(IntPtr hWnd, ref PAINTSTRUCT lpPaint);
|
||||
|
||||
[DllImport("gdi32.dll")]
|
||||
public static extern int SelectClipRgn(IntPtr hDC, IntPtr hRgn);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern int GetUpdateRgn(IntPtr hwnd, IntPtr hrgn, bool fErase);
|
||||
public enum RegionFlags
|
||||
{
|
||||
ERROR = 0,
|
||||
NULLREGION = 1,
|
||||
SIMPLEREGION = 2,
|
||||
COMPLEXREGION = 3,
|
||||
}
|
||||
[DllImport("gdi32.dll")]
|
||||
internal static extern bool DeleteObject(IntPtr hObject);
|
||||
|
||||
[DllImport("gdi32.dll")]
|
||||
private static extern IntPtr CreateRectRgn(int x1, int y1, int x2, int y2);
|
||||
}
|
||||
|
||||
public class RButton : Button
|
||||
{
|
||||
//Fields
|
||||
private int borderSize = 5;
|
||||
|
||||
private int borderRadius = 5;
|
||||
public int BorderRadius
|
||||
{
|
||||
get { return borderRadius; }
|
||||
set
|
||||
{
|
||||
borderRadius = value;
|
||||
}
|
||||
}
|
||||
|
||||
private Color borderColor = Color.Transparent;
|
||||
public Color BorderColor
|
||||
{
|
||||
get { return borderColor; }
|
||||
set
|
||||
{
|
||||
borderColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool activated = false;
|
||||
public bool Activated
|
||||
{
|
||||
get { return activated; }
|
||||
set
|
||||
{
|
||||
if (activated != value)
|
||||
this.Invalidate();
|
||||
activated = value;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private bool secondary = false;
|
||||
public bool Secondary
|
||||
{
|
||||
get { return secondary; }
|
||||
set
|
||||
{
|
||||
secondary = value;
|
||||
}
|
||||
}
|
||||
|
||||
public RButton()
|
||||
{
|
||||
DoubleBuffered = true;
|
||||
FlatStyle = FlatStyle.Flat;
|
||||
FlatAppearance.BorderSize = 0;
|
||||
}
|
||||
|
||||
private GraphicsPath GetFigurePath(Rectangle rect, int radius)
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
float curveSize = radius * 2F;
|
||||
|
||||
path.StartFigure();
|
||||
path.AddArc(rect.X, rect.Y, curveSize, curveSize, 180, 90);
|
||||
path.AddArc(rect.Right - curveSize, rect.Y, curveSize, curveSize, 270, 90);
|
||||
path.AddArc(rect.Right - curveSize, rect.Bottom - curveSize, curveSize, curveSize, 0, 90);
|
||||
path.AddArc(rect.X, rect.Bottom - curveSize, curveSize, curveSize, 90, 90);
|
||||
path.CloseFigure();
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pevent)
|
||||
{
|
||||
|
||||
base.OnPaint(pevent);
|
||||
|
||||
float ratio = pevent.Graphics.DpiX / 192.0f;
|
||||
int border = (int)(ratio * borderSize);
|
||||
|
||||
Rectangle rectSurface = this.ClientRectangle;
|
||||
Rectangle rectBorder = Rectangle.Inflate(rectSurface, -border, -border);
|
||||
|
||||
Color borderDrawColor = activated ? borderColor : Color.Transparent;
|
||||
|
||||
using (GraphicsPath pathSurface = GetFigurePath(rectSurface, borderRadius + border))
|
||||
using (GraphicsPath pathBorder = GetFigurePath(rectBorder, borderRadius))
|
||||
using (Pen penSurface = new Pen(this.Parent.BackColor, border))
|
||||
using (Pen penBorder = new Pen(borderDrawColor, border))
|
||||
{
|
||||
penBorder.Alignment = PenAlignment.Outset;
|
||||
pevent.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
this.Region = new Region(pathSurface);
|
||||
pevent.Graphics.DrawPath(penSurface, pathSurface);
|
||||
pevent.Graphics.DrawPath(penBorder, pathBorder);
|
||||
}
|
||||
|
||||
if (!Enabled && ForeColor != SystemColors.ControlText)
|
||||
{
|
||||
var rect = pevent.ClipRectangle;
|
||||
if (Image is not null)
|
||||
{
|
||||
rect.Y += Image.Height;
|
||||
rect.Height -= Image.Height;
|
||||
}
|
||||
TextFormatFlags flags = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.WordBreak;
|
||||
TextRenderer.DrawText(pevent.Graphics, this.Text, this.Font, rect, Color.Gray, flags);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
120
app/CustomControls.resx
Normal file
120
app/CustomControls.resx
Normal 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>
|
||||
392
app/Extra.Designer.cs
generated
Normal file
392
app/Extra.Designer.cs
generated
Normal file
@@ -0,0 +1,392 @@
|
||||
using CustomControls;
|
||||
using GHelper.Properties;
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
partial class Extra
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
groupBindings = new GroupBox();
|
||||
pictureHelp = new PictureBox();
|
||||
textFNF4 = new TextBox();
|
||||
comboFNF4 = new RComboBox();
|
||||
labelFNF4 = new Label();
|
||||
textM4 = new TextBox();
|
||||
textM3 = new TextBox();
|
||||
comboM4 = new RComboBox();
|
||||
labelM4 = new Label();
|
||||
comboM3 = new RComboBox();
|
||||
labelM3 = new Label();
|
||||
groupLight = new GroupBox();
|
||||
labelBrightness = new Label();
|
||||
trackBrightness = new TrackBar();
|
||||
labelSpeed = new Label();
|
||||
comboKeyboardSpeed = new RComboBox();
|
||||
checkShutdown = new CheckBox();
|
||||
checkSleep = new CheckBox();
|
||||
checkBoot = new CheckBox();
|
||||
checkAwake = new CheckBox();
|
||||
groupOther = new GroupBox();
|
||||
checkUSBC = new CheckBox();
|
||||
checkNoOverdrive = new CheckBox();
|
||||
checkKeyboardAuto = new CheckBox();
|
||||
checkTopmost = new CheckBox();
|
||||
groupBindings.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureHelp).BeginInit();
|
||||
groupLight.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)trackBrightness).BeginInit();
|
||||
groupOther.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBindings
|
||||
//
|
||||
groupBindings.Controls.Add(pictureHelp);
|
||||
groupBindings.Controls.Add(textFNF4);
|
||||
groupBindings.Controls.Add(comboFNF4);
|
||||
groupBindings.Controls.Add(labelFNF4);
|
||||
groupBindings.Controls.Add(textM4);
|
||||
groupBindings.Controls.Add(textM3);
|
||||
groupBindings.Controls.Add(comboM4);
|
||||
groupBindings.Controls.Add(labelM4);
|
||||
groupBindings.Controls.Add(comboM3);
|
||||
groupBindings.Controls.Add(labelM3);
|
||||
groupBindings.Dock = DockStyle.Top;
|
||||
groupBindings.Location = new Point(10, 10);
|
||||
groupBindings.Name = "groupBindings";
|
||||
groupBindings.Size = new Size(844, 242);
|
||||
groupBindings.TabIndex = 0;
|
||||
groupBindings.TabStop = false;
|
||||
groupBindings.Text = "Key Bindings";
|
||||
//
|
||||
// pictureHelp
|
||||
//
|
||||
pictureHelp.BackgroundImage = Resources.icons8_help_64;
|
||||
pictureHelp.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
pictureHelp.Cursor = Cursors.Hand;
|
||||
pictureHelp.Location = new Point(744, 57);
|
||||
pictureHelp.Name = "pictureHelp";
|
||||
pictureHelp.Size = new Size(32, 32);
|
||||
pictureHelp.TabIndex = 9;
|
||||
pictureHelp.TabStop = false;
|
||||
//
|
||||
// textFNF4
|
||||
//
|
||||
textFNF4.Location = new Point(415, 176);
|
||||
textFNF4.Name = "textFNF4";
|
||||
textFNF4.PlaceholderText = "action";
|
||||
textFNF4.Size = new Size(320, 39);
|
||||
textFNF4.TabIndex = 8;
|
||||
//
|
||||
// comboFNF4
|
||||
//
|
||||
comboFNF4.BorderColor = Color.White;
|
||||
comboFNF4.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||
comboFNF4.FormattingEnabled = true;
|
||||
comboFNF4.Location = new Point(93, 175);
|
||||
comboFNF4.Name = "comboFNF4";
|
||||
comboFNF4.Size = new Size(312, 40);
|
||||
comboFNF4.TabIndex = 7;
|
||||
//
|
||||
// labelFNF4
|
||||
//
|
||||
labelFNF4.AutoSize = true;
|
||||
labelFNF4.Location = new Point(2, 178);
|
||||
labelFNF4.Name = "labelFNF4";
|
||||
labelFNF4.Size = new Size(90, 32);
|
||||
labelFNF4.TabIndex = 6;
|
||||
labelFNF4.Text = "FN+F4:";
|
||||
//
|
||||
// textM4
|
||||
//
|
||||
textM4.Location = new Point(415, 113);
|
||||
textM4.Name = "textM4";
|
||||
textM4.PlaceholderText = "action";
|
||||
textM4.Size = new Size(320, 39);
|
||||
textM4.TabIndex = 5;
|
||||
//
|
||||
// textM3
|
||||
//
|
||||
textM3.Location = new Point(415, 54);
|
||||
textM3.Name = "textM3";
|
||||
textM3.PlaceholderText = "notepad /p \"file.txt\"";
|
||||
textM3.Size = new Size(320, 39);
|
||||
textM3.TabIndex = 4;
|
||||
//
|
||||
// comboM4
|
||||
//
|
||||
comboM4.BorderColor = Color.White;
|
||||
comboM4.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||
comboM4.FormattingEnabled = true;
|
||||
comboM4.Items.AddRange(new object[] { Strings.PerformanceMode, Strings.OpenGHelper, Strings.Custom });
|
||||
comboM4.Location = new Point(93, 112);
|
||||
comboM4.Name = "comboM4";
|
||||
comboM4.Size = new Size(312, 40);
|
||||
comboM4.TabIndex = 3;
|
||||
//
|
||||
// labelM4
|
||||
//
|
||||
labelM4.AutoSize = true;
|
||||
labelM4.Location = new Point(25, 116);
|
||||
labelM4.Name = "labelM4";
|
||||
labelM4.Size = new Size(54, 32);
|
||||
labelM4.TabIndex = 2;
|
||||
labelM4.Text = "M4:";
|
||||
//
|
||||
// comboM3
|
||||
//
|
||||
comboM3.BorderColor = Color.White;
|
||||
comboM3.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||
comboM3.FormattingEnabled = true;
|
||||
comboM3.Items.AddRange(new object[] { Strings.Default, Strings.VolumeMute, Strings.PlayPause, Strings.PrintScreen, Strings.ToggleAura, Strings.Custom });
|
||||
comboM3.Location = new Point(93, 54);
|
||||
comboM3.Name = "comboM3";
|
||||
comboM3.Size = new Size(312, 40);
|
||||
comboM3.TabIndex = 1;
|
||||
//
|
||||
// labelM3
|
||||
//
|
||||
labelM3.AutoSize = true;
|
||||
labelM3.Location = new Point(25, 58);
|
||||
labelM3.Name = "labelM3";
|
||||
labelM3.Size = new Size(54, 32);
|
||||
labelM3.TabIndex = 0;
|
||||
labelM3.Text = "M3:";
|
||||
//
|
||||
// groupLight
|
||||
//
|
||||
groupLight.Controls.Add(labelBrightness);
|
||||
groupLight.Controls.Add(trackBrightness);
|
||||
groupLight.Controls.Add(labelSpeed);
|
||||
groupLight.Controls.Add(comboKeyboardSpeed);
|
||||
groupLight.Controls.Add(checkShutdown);
|
||||
groupLight.Controls.Add(checkSleep);
|
||||
groupLight.Controls.Add(checkBoot);
|
||||
groupLight.Controls.Add(checkAwake);
|
||||
groupLight.Dock = DockStyle.Top;
|
||||
groupLight.Location = new Point(10, 252);
|
||||
groupLight.Name = "groupLight";
|
||||
groupLight.Size = new Size(844, 395);
|
||||
groupLight.TabIndex = 1;
|
||||
groupLight.TabStop = false;
|
||||
groupLight.Text = "Keyboard Backlight";
|
||||
//
|
||||
// labelBrightness
|
||||
//
|
||||
labelBrightness.Location = new Point(25, 304);
|
||||
labelBrightness.Name = "labelBrightness";
|
||||
labelBrightness.Size = new Size(197, 49);
|
||||
labelBrightness.TabIndex = 0;
|
||||
labelBrightness.Text = "Brightness";
|
||||
//
|
||||
// trackBrightness
|
||||
//
|
||||
trackBrightness.Location = new Point(228, 294);
|
||||
trackBrightness.Maximum = 3;
|
||||
trackBrightness.Name = "trackBrightness";
|
||||
trackBrightness.Size = new Size(600, 90);
|
||||
trackBrightness.TabIndex = 1;
|
||||
trackBrightness.TickStyle = TickStyle.TopLeft;
|
||||
//
|
||||
// labelSpeed
|
||||
//
|
||||
labelSpeed.AutoSize = true;
|
||||
labelSpeed.Location = new Point(25, 235);
|
||||
labelSpeed.MaximumSize = new Size(200, 0);
|
||||
labelSpeed.Name = "labelSpeed";
|
||||
labelSpeed.Size = new Size(198, 32);
|
||||
labelSpeed.TabIndex = 40;
|
||||
labelSpeed.Text = "Animation Speed";
|
||||
//
|
||||
// comboKeyboardSpeed
|
||||
//
|
||||
comboKeyboardSpeed.BorderColor = Color.White;
|
||||
comboKeyboardSpeed.ButtonColor = SystemColors.ControlLight;
|
||||
comboKeyboardSpeed.FlatStyle = FlatStyle.Flat;
|
||||
comboKeyboardSpeed.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
comboKeyboardSpeed.FormattingEnabled = true;
|
||||
comboKeyboardSpeed.ItemHeight = 32;
|
||||
comboKeyboardSpeed.Items.AddRange(new object[] { "Slow", "Normal", "Fast" });
|
||||
comboKeyboardSpeed.Location = new Point(230, 232);
|
||||
comboKeyboardSpeed.Margin = new Padding(4, 10, 4, 8);
|
||||
comboKeyboardSpeed.Name = "comboKeyboardSpeed";
|
||||
comboKeyboardSpeed.Size = new Size(291, 40);
|
||||
comboKeyboardSpeed.TabIndex = 39;
|
||||
comboKeyboardSpeed.TabStop = false;
|
||||
//
|
||||
// checkShutdown
|
||||
//
|
||||
checkShutdown.AutoSize = true;
|
||||
checkShutdown.Location = new Point(25, 185);
|
||||
checkShutdown.Name = "checkShutdown";
|
||||
checkShutdown.Size = new Size(154, 36);
|
||||
checkShutdown.TabIndex = 3;
|
||||
checkShutdown.Text = Strings.Shutdown;
|
||||
checkShutdown.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkSleep
|
||||
//
|
||||
checkSleep.AutoSize = true;
|
||||
checkSleep.Location = new Point(25, 143);
|
||||
checkSleep.Name = "checkSleep";
|
||||
checkSleep.Size = new Size(105, 36);
|
||||
checkSleep.TabIndex = 2;
|
||||
checkSleep.Text = Strings.Sleep;
|
||||
checkSleep.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoot
|
||||
//
|
||||
checkBoot.AutoSize = true;
|
||||
checkBoot.Location = new Point(25, 101);
|
||||
checkBoot.Name = "checkBoot";
|
||||
checkBoot.Size = new Size(96, 36);
|
||||
checkBoot.TabIndex = 1;
|
||||
checkBoot.Text = Strings.Boot;
|
||||
checkBoot.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkAwake
|
||||
//
|
||||
checkAwake.AutoSize = true;
|
||||
checkAwake.Location = new Point(25, 59);
|
||||
checkAwake.Name = "checkAwake";
|
||||
checkAwake.Size = new Size(115, 36);
|
||||
checkAwake.TabIndex = 0;
|
||||
checkAwake.Text = Strings.Awake;
|
||||
checkAwake.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupOther
|
||||
//
|
||||
groupOther.Controls.Add(checkUSBC);
|
||||
groupOther.Controls.Add(checkNoOverdrive);
|
||||
groupOther.Controls.Add(checkKeyboardAuto);
|
||||
groupOther.Controls.Add(checkTopmost);
|
||||
groupOther.Dock = DockStyle.Top;
|
||||
groupOther.Location = new Point(10, 647);
|
||||
groupOther.Name = "groupOther";
|
||||
groupOther.Size = new Size(844, 293);
|
||||
groupOther.TabIndex = 2;
|
||||
groupOther.TabStop = false;
|
||||
groupOther.Text = "Other";
|
||||
//
|
||||
// checkUSBC
|
||||
//
|
||||
checkUSBC.AutoSize = true;
|
||||
checkUSBC.Location = new Point(25, 210);
|
||||
checkUSBC.Name = "checkUSBC";
|
||||
checkUSBC.Size = new Size(659, 36);
|
||||
checkUSBC.TabIndex = 4;
|
||||
checkUSBC.Text = "Keep GPU disabled on USB-C charger in Optimized mode";
|
||||
checkUSBC.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkNoOverdrive
|
||||
//
|
||||
checkNoOverdrive.AutoSize = true;
|
||||
checkNoOverdrive.Location = new Point(25, 156);
|
||||
checkNoOverdrive.Name = "checkNoOverdrive";
|
||||
checkNoOverdrive.Size = new Size(307, 36);
|
||||
checkNoOverdrive.TabIndex = 3;
|
||||
checkNoOverdrive.Text = Strings.DisableOverdrive;
|
||||
checkNoOverdrive.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkKeyboardAuto
|
||||
//
|
||||
checkKeyboardAuto.AutoSize = true;
|
||||
checkKeyboardAuto.Location = new Point(25, 51);
|
||||
checkKeyboardAuto.MaximumSize = new Size(780, 0);
|
||||
checkKeyboardAuto.Name = "checkKeyboardAuto";
|
||||
checkKeyboardAuto.Size = new Size(712, 36);
|
||||
checkKeyboardAuto.TabIndex = 2;
|
||||
checkKeyboardAuto.Text = Strings.KeyboardAuto;
|
||||
checkKeyboardAuto.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkTopmost
|
||||
//
|
||||
checkTopmost.AutoSize = true;
|
||||
checkTopmost.Location = new Point(25, 104);
|
||||
checkTopmost.Name = "checkTopmost";
|
||||
checkTopmost.Size = new Size(390, 36);
|
||||
checkTopmost.TabIndex = 1;
|
||||
checkTopmost.Text = Strings.WindowTop;
|
||||
checkTopmost.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// Extra
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(864, 953);
|
||||
Controls.Add(groupOther);
|
||||
Controls.Add(groupLight);
|
||||
Controls.Add(groupBindings);
|
||||
FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||
MaximizeBox = false;
|
||||
MdiChildrenMinimizedAnchorBottom = false;
|
||||
MinimizeBox = false;
|
||||
Name = "Extra";
|
||||
Padding = new Padding(10);
|
||||
ShowIcon = false;
|
||||
ShowInTaskbar = false;
|
||||
Text = "Extra Settings";
|
||||
groupBindings.ResumeLayout(false);
|
||||
groupBindings.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureHelp).EndInit();
|
||||
groupLight.ResumeLayout(false);
|
||||
groupLight.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)trackBrightness).EndInit();
|
||||
groupOther.ResumeLayout(false);
|
||||
groupOther.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBindings;
|
||||
private Label labelM3;
|
||||
private RComboBox comboM3;
|
||||
private RComboBox comboM4;
|
||||
private Label labelM4;
|
||||
private TextBox textM4;
|
||||
private TextBox textM3;
|
||||
private TextBox textFNF4;
|
||||
private RComboBox comboFNF4;
|
||||
private Label labelFNF4;
|
||||
private GroupBox groupLight;
|
||||
private CheckBox checkSleep;
|
||||
private CheckBox checkBoot;
|
||||
private CheckBox checkAwake;
|
||||
private CheckBox checkShutdown;
|
||||
private Label labelSpeed;
|
||||
private RComboBox comboKeyboardSpeed;
|
||||
private GroupBox groupOther;
|
||||
private CheckBox checkTopmost;
|
||||
private CheckBox checkKeyboardAuto;
|
||||
private CheckBox checkNoOverdrive;
|
||||
private PictureBox pictureHelp;
|
||||
private TrackBar trackBrightness;
|
||||
private Label labelBrightness;
|
||||
private CheckBox checkUSBC;
|
||||
}
|
||||
}
|
||||
180
app/Extra.cs
Normal file
180
app/Extra.cs
Normal file
@@ -0,0 +1,180 @@
|
||||
using CustomControls;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
public partial class Extra : RForm
|
||||
{
|
||||
|
||||
Dictionary<string, string> customActions = new Dictionary<string, string>
|
||||
{
|
||||
{"","--------------" },
|
||||
{"mute", Properties.Strings.VolumeMute},
|
||||
{"screenshot", Properties.Strings.PrintScreen},
|
||||
{"play", Properties.Strings.PlayPause},
|
||||
{"aura", Properties.Strings.ToggleAura},
|
||||
{"performance", Properties.Strings.PerformanceMode},
|
||||
{"screen", Properties.Strings.ToggleScreen},
|
||||
{"miniled", Properties.Strings.ToggleMiniled},
|
||||
{"custom", Properties.Strings.Custom}
|
||||
};
|
||||
|
||||
private void SetKeyCombo(ComboBox combo, TextBox txbox, string name)
|
||||
{
|
||||
if (name == "m4")
|
||||
customActions[""] = Properties.Strings.OpenGHelper;
|
||||
|
||||
if (name == "fnf4")
|
||||
{
|
||||
customActions[""] = Properties.Strings.ToggleAura;
|
||||
customActions.Remove("aura");
|
||||
}
|
||||
|
||||
combo.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
combo.DataSource = new BindingSource(customActions, null);
|
||||
combo.DisplayMember = "Value";
|
||||
combo.ValueMember = "Key";
|
||||
|
||||
string action = Program.config.getConfigString(name);
|
||||
|
||||
combo.SelectedValue = (action is not null) ? action : "";
|
||||
if (combo.SelectedValue is null) combo.SelectedValue = "";
|
||||
|
||||
combo.SelectedValueChanged += delegate
|
||||
{
|
||||
if (combo.SelectedValue is not null)
|
||||
Program.config.setConfig(name, combo.SelectedValue.ToString());
|
||||
};
|
||||
|
||||
txbox.Text = Program.config.getConfigString(name + "_custom");
|
||||
txbox.TextChanged += delegate
|
||||
{
|
||||
Program.config.setConfig(name + "_custom", txbox.Text);
|
||||
};
|
||||
}
|
||||
|
||||
public Extra()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
groupBindings.Text = Properties.Strings.KeyBindings;
|
||||
groupLight.Text = Properties.Strings.KeyboardBacklight;
|
||||
groupOther.Text = Properties.Strings.Other;
|
||||
|
||||
checkAwake.Text = Properties.Strings.Awake;
|
||||
checkSleep.Text = Properties.Strings.Sleep;
|
||||
checkBoot.Text = Properties.Strings.Boot;
|
||||
checkShutdown.Text = Properties.Strings.Shutdown;
|
||||
|
||||
labelSpeed.Text = Properties.Strings.AnimationSpeed;
|
||||
labelBrightness.Text = Properties.Strings.Brightness;
|
||||
|
||||
checkKeyboardAuto.Text = Properties.Strings.KeyboardAuto;
|
||||
checkNoOverdrive.Text = Properties.Strings.DisableOverdrive;
|
||||
checkTopmost.Text = Properties.Strings.WindowTop;
|
||||
checkUSBC.Text = Properties.Strings.OptimizedUSBC;
|
||||
|
||||
Text = Properties.Strings.ExtraSettings;
|
||||
|
||||
InitTheme();
|
||||
|
||||
SetKeyCombo(comboM3, textM3, "m3");
|
||||
SetKeyCombo(comboM4, textM4, "m4");
|
||||
SetKeyCombo(comboFNF4, textFNF4, "fnf4");
|
||||
|
||||
Shown += Keyboard_Shown;
|
||||
|
||||
comboKeyboardSpeed.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboKeyboardSpeed.DataSource = new BindingSource(Aura.GetSpeeds(), null);
|
||||
comboKeyboardSpeed.DisplayMember = "Value";
|
||||
comboKeyboardSpeed.ValueMember = "Key";
|
||||
comboKeyboardSpeed.SelectedValue = Aura.Speed;
|
||||
comboKeyboardSpeed.SelectedValueChanged += ComboKeyboardSpeed_SelectedValueChanged;
|
||||
|
||||
checkAwake.Checked = !(Program.config.getConfig("keyboard_awake") == 0);
|
||||
checkBoot.Checked = !(Program.config.getConfig("keyboard_boot") == 0);
|
||||
checkSleep.Checked = !(Program.config.getConfig("keyboard_sleep") == 0);
|
||||
checkShutdown.Checked = !(Program.config.getConfig("keyboard_shutdown") == 0);
|
||||
|
||||
checkAwake.CheckedChanged += CheckPower_CheckedChanged;
|
||||
checkBoot.CheckedChanged += CheckPower_CheckedChanged;
|
||||
checkSleep.CheckedChanged += CheckPower_CheckedChanged;
|
||||
checkShutdown.CheckedChanged += CheckPower_CheckedChanged;
|
||||
|
||||
checkTopmost.Checked = (Program.config.getConfig("topmost") == 1);
|
||||
checkTopmost.CheckedChanged += CheckTopmost_CheckedChanged; ;
|
||||
|
||||
checkKeyboardAuto.Checked = (Program.config.getConfig("keyboard_auto") == 1);
|
||||
checkKeyboardAuto.CheckedChanged += CheckKeyboardAuto_CheckedChanged;
|
||||
|
||||
checkNoOverdrive.Checked = (Program.config.getConfig("no_overdrive") == 1);
|
||||
checkNoOverdrive.CheckedChanged += CheckNoOverdrive_CheckedChanged;
|
||||
|
||||
checkUSBC.Checked = (Program.config.getConfig("optimized_usbc") == 1);
|
||||
checkUSBC.CheckedChanged += CheckUSBC_CheckedChanged;
|
||||
|
||||
int kb_brightness = Program.config.getConfig("keyboard_brightness");
|
||||
trackBrightness.Value = (kb_brightness >= 0 && kb_brightness <= 3) ? kb_brightness : 3;
|
||||
|
||||
pictureHelp.Click += PictureHelp_Click;
|
||||
trackBrightness.Scroll += TrackBrightness_Scroll;
|
||||
|
||||
}
|
||||
|
||||
private void CheckUSBC_CheckedChanged(object? sender, EventArgs e)
|
||||
{
|
||||
Program.config.setConfig("optimized_usbc", (checkUSBC.Checked ? 1 : 0));
|
||||
}
|
||||
|
||||
private void TrackBrightness_Scroll(object? sender, EventArgs e)
|
||||
{
|
||||
Program.config.setConfig("keyboard_brightness", trackBrightness.Value);
|
||||
Aura.ApplyBrightness(trackBrightness.Value);
|
||||
}
|
||||
|
||||
private void PictureHelp_Click(object? sender, EventArgs e)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo("https://github.com/seerge/g-helper#custom-hotkey-actions") { UseShellExecute = true });
|
||||
}
|
||||
|
||||
private void CheckNoOverdrive_CheckedChanged(object? sender, EventArgs e)
|
||||
{
|
||||
Program.config.setConfig("no_overdrive", (checkNoOverdrive.Checked ? 1 : 0));
|
||||
Program.settingsForm.AutoScreen(true);
|
||||
}
|
||||
|
||||
private void CheckKeyboardAuto_CheckedChanged(object? sender, EventArgs e)
|
||||
{
|
||||
Program.config.setConfig("keyboard_auto", (checkKeyboardAuto.Checked ? 1 : 0));
|
||||
}
|
||||
|
||||
private void CheckTopmost_CheckedChanged(object? sender, EventArgs e)
|
||||
{
|
||||
Program.config.setConfig("topmost", (checkTopmost.Checked ? 1 : 0));
|
||||
Program.settingsForm.TopMost = checkTopmost.Checked;
|
||||
}
|
||||
|
||||
private void CheckPower_CheckedChanged(object? sender, EventArgs e)
|
||||
{
|
||||
Program.config.setConfig("keyboard_awake", (checkAwake.Checked ? 1 : 0));
|
||||
Program.config.setConfig("keyboard_boot", (checkBoot.Checked ? 1 : 0));
|
||||
Program.config.setConfig("keyboard_sleep", (checkSleep.Checked ? 1 : 0));
|
||||
Program.config.setConfig("keyboard_shutdown", (checkShutdown.Checked ? 1 : 0));
|
||||
|
||||
Aura.ApplyAuraPower(checkAwake.Checked, checkBoot.Checked, checkSleep.Checked, checkShutdown.Checked);
|
||||
}
|
||||
|
||||
private void ComboKeyboardSpeed_SelectedValueChanged(object? sender, EventArgs e)
|
||||
{
|
||||
Program.config.setConfig("aura_speed", (int)comboKeyboardSpeed.SelectedValue);
|
||||
Program.settingsForm.SetAura();
|
||||
}
|
||||
|
||||
|
||||
private void Keyboard_Shown(object? sender, EventArgs e)
|
||||
{
|
||||
Top = Program.settingsForm.Top;
|
||||
Left = Program.settingsForm.Left - Width - 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
819
app/Fans.Designer.cs
generated
819
app/Fans.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
535
app/Fans.cs
535
app/Fans.cs
@@ -1,24 +1,196 @@
|
||||
using System;
|
||||
using CustomControls;
|
||||
using GHelper.Gpu;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.Metrics;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing.Text;
|
||||
using System.IO;
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
public partial class Fans : Form
|
||||
public partial class Fans : RForm
|
||||
{
|
||||
|
||||
DataPoint curPoint = null;
|
||||
Series seriesCPU;
|
||||
Series seriesGPU;
|
||||
Series seriesMid;
|
||||
|
||||
static int MinRPM, MaxRPM;
|
||||
|
||||
public Fans()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
Text = Properties.Strings.FansAndPower;
|
||||
labelPowerLimits.Text = Properties.Strings.PowerLimits;
|
||||
labelInfo.Text = Properties.Strings.PPTExperimental;
|
||||
checkApplyPower.Text = Properties.Strings.ApplyPowerLimits;
|
||||
|
||||
labelFans.Text = Properties.Strings.FanCurves;
|
||||
labelBoost.Text = Properties.Strings.CPUBoost;
|
||||
buttonReset.Text = Properties.Strings.FactoryDefaults;
|
||||
checkApplyFans.Text = Properties.Strings.ApplyFanCurve;
|
||||
|
||||
InitTheme();
|
||||
|
||||
MinRPM = 18;
|
||||
MaxRPM = HardwareMonitor.GetFanMax();
|
||||
labelTip.Visible = false;
|
||||
labelTip.BackColor = Color.Transparent;
|
||||
|
||||
FormClosing += Fans_FormClosing;
|
||||
|
||||
seriesCPU = chartCPU.Series.Add("CPU");
|
||||
seriesGPU = chartGPU.Series.Add("GPU");
|
||||
seriesMid = chartMid.Series.Add("Mid");
|
||||
|
||||
seriesCPU.Color = colorStandard;
|
||||
seriesGPU.Color = colorTurbo;
|
||||
seriesMid.Color = colorEco;
|
||||
|
||||
chartCPU.MouseMove += ChartCPU_MouseMove;
|
||||
chartCPU.MouseUp += ChartCPU_MouseUp;
|
||||
|
||||
chartGPU.MouseMove += ChartCPU_MouseMove;
|
||||
chartGPU.MouseUp += ChartCPU_MouseUp;
|
||||
|
||||
chartMid.MouseMove += ChartCPU_MouseMove;
|
||||
chartMid.MouseUp += ChartCPU_MouseUp;
|
||||
|
||||
buttonReset.Click += ButtonReset_Click;
|
||||
|
||||
trackTotal.Maximum = ASUSWmi.MaxTotal;
|
||||
trackTotal.Minimum = ASUSWmi.MinTotal;
|
||||
|
||||
trackCPU.Maximum = ASUSWmi.MaxCPU;
|
||||
trackCPU.Minimum = ASUSWmi.MinCPU;
|
||||
|
||||
trackCPU.Scroll += TrackPower_Scroll;
|
||||
trackTotal.Scroll += TrackPower_Scroll;
|
||||
|
||||
trackCPU.MouseUp += TrackPower_MouseUp;
|
||||
trackTotal.MouseUp += TrackPower_MouseUp;
|
||||
|
||||
checkApplyFans.Click += CheckApplyFans_Click;
|
||||
checkApplyPower.Click += CheckApplyPower_Click;
|
||||
|
||||
trackGPUCore.Minimum = NvidiaGpuControl.MinCoreOffset;
|
||||
trackGPUCore.Maximum = NvidiaGpuControl.MaxCoreOffset;
|
||||
|
||||
trackGPUMemory.Minimum = NvidiaGpuControl.MinMemoryOffset;
|
||||
trackGPUMemory.Maximum = NvidiaGpuControl.MaxMemoryOffset;
|
||||
|
||||
trackGPUBoost.Minimum = ASUSWmi.MinGPUBoost;
|
||||
trackGPUBoost.Maximum = ASUSWmi.MaxGPUBoost;
|
||||
|
||||
trackGPUTemp.Minimum = ASUSWmi.MinGPUTemp;
|
||||
trackGPUTemp.Maximum = ASUSWmi.MaxGPUTemp;
|
||||
|
||||
trackGPUCore.Scroll += trackGPU_Scroll;
|
||||
trackGPUMemory.Scroll += trackGPU_Scroll;
|
||||
trackGPUBoost.Scroll += trackGPU_Scroll;
|
||||
trackGPUTemp.Scroll += trackGPU_Scroll;
|
||||
|
||||
trackGPUCore.MouseUp += TrackGPU_MouseUp;
|
||||
trackGPUMemory.MouseUp += TrackGPU_MouseUp;
|
||||
|
||||
trackGPUBoost.MouseUp += TrackGPUBoost_MouseUp;
|
||||
trackGPUTemp.MouseUp += TrackGPUBoost_MouseUp;
|
||||
|
||||
//labelInfo.MaximumSize = new Size(280, 0);
|
||||
labelInfo.Text = Properties.Strings.PPTExperimental;
|
||||
labelFansResult.Visible = false;
|
||||
|
||||
InitFans();
|
||||
InitPower();
|
||||
InitBoost();
|
||||
|
||||
comboBoost.SelectedValueChanged += ComboBoost_Changed;
|
||||
|
||||
Shown += Fans_Shown;
|
||||
|
||||
InitGPUClocks();
|
||||
|
||||
}
|
||||
|
||||
private void TrackGPUBoost_MouseUp(object? sender, MouseEventArgs e)
|
||||
{
|
||||
Program.config.setConfig("gpu_boost", trackGPUBoost.Value);
|
||||
Program.config.setConfig("gpu_temp", trackGPUTemp.Value);
|
||||
Program.settingsForm.SetGPUPower();
|
||||
}
|
||||
|
||||
private void TrackGPU_MouseUp(object? sender, MouseEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Program.config.setConfig("gpu_core", trackGPUCore.Value);
|
||||
Program.config.setConfig("gpu_memory", trackGPUMemory.Value);
|
||||
|
||||
int status = Program.nvControl.SetClocks(trackGPUCore.Value, trackGPUMemory.Value);
|
||||
if (status == -1) Program.RunAsAdmin("gpu");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine("F:" + ex.ToString());
|
||||
}
|
||||
|
||||
InitGPUClocks();
|
||||
}
|
||||
|
||||
private void InitGPUClocks()
|
||||
{
|
||||
if (Program.nvControl is null || !Program.nvControl.IsValid)
|
||||
{
|
||||
panelGPU.Visible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
panelGPU.Visible = true;
|
||||
|
||||
Program.nvControl.GetClocks(out int core, out int memory);
|
||||
trackGPUCore.Value = Math.Max(Math.Min(core, NvidiaGpuControl.MaxCoreOffset), NvidiaGpuControl.MinCoreOffset);
|
||||
trackGPUMemory.Value = Math.Max(Math.Min(memory, NvidiaGpuControl.MaxMemoryOffset), NvidiaGpuControl.MinMemoryOffset);
|
||||
|
||||
int gpu_boost = Program.config.getConfig("gpu_boost");
|
||||
int gpu_temp = Program.config.getConfig("gpu_temp");
|
||||
|
||||
if (gpu_boost < 0) gpu_boost = ASUSWmi.MaxGPUBoost;
|
||||
if (gpu_temp < 0) gpu_temp = ASUSWmi.MaxGPUTemp;
|
||||
|
||||
trackGPUBoost.Value = Math.Max(Math.Min(gpu_boost, ASUSWmi.MaxGPUBoost), ASUSWmi.MinGPUBoost);
|
||||
trackGPUTemp.Value = Math.Max(Math.Min(gpu_temp, ASUSWmi.MaxGPUTemp), ASUSWmi.MinGPUTemp);
|
||||
|
||||
VisualiseGPUSettings();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.ToString());
|
||||
panelGPU.Visible = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void VisualiseGPUSettings()
|
||||
{
|
||||
labelGPUCore.Text = $"{trackGPUCore.Value} MHz";
|
||||
labelGPUMemory.Text = $"{trackGPUMemory.Value} MHz";
|
||||
labelGPUBoost.Text = $"{trackGPUBoost.Value}W";
|
||||
labelGPUTemp.Text = $"{trackGPUTemp.Value}°C";
|
||||
}
|
||||
|
||||
private void trackGPU_Scroll(object? sender, EventArgs e)
|
||||
{
|
||||
VisualiseGPUSettings();
|
||||
}
|
||||
|
||||
static string ChartPercToRPM(int percentage, string unit = "")
|
||||
{
|
||||
if (percentage == 0) return "OFF";
|
||||
return (1800 + 200 * Math.Floor(percentage * 0.2)).ToString() + unit;
|
||||
|
||||
return (200 * Math.Round((float)(MinRPM * 100 + (MaxRPM - MinRPM) * percentage) / 200)).ToString() + unit;
|
||||
}
|
||||
|
||||
void SetChart(Chart chart, int device)
|
||||
@@ -27,20 +199,16 @@ namespace GHelper
|
||||
string title;
|
||||
|
||||
if (device == 1)
|
||||
title = "GPU Fan Profile";
|
||||
title = Properties.Strings.FanProfileGPU;
|
||||
else if (device == 2)
|
||||
title = Properties.Strings.FanProfileMid;
|
||||
else
|
||||
title = "CPU Fan Profile";
|
||||
title = Properties.Strings.FanProfileCPU;
|
||||
|
||||
if (Program.settingsForm.perfName.Length > 0)
|
||||
labelFans.Text = "Fan Profiles: " + Program.settingsForm.perfName;
|
||||
labelFans.Text = Properties.Strings.FanProfiles + ": " + Program.settingsForm.perfName;
|
||||
|
||||
if (chart.Titles.Count > 0)
|
||||
chart.Titles[0].Text = title;
|
||||
else
|
||||
chart.Titles.Add(title);
|
||||
|
||||
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = Color.LightGray;
|
||||
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.LightGray;
|
||||
chart.Titles[0].Text = title;
|
||||
|
||||
chart.ChartAreas[0].AxisX.Minimum = 10;
|
||||
chart.ChartAreas[0].AxisX.Maximum = 100;
|
||||
@@ -51,10 +219,15 @@ namespace GHelper
|
||||
|
||||
chart.ChartAreas[0].AxisY.LabelStyle.Font = new Font("Arial", 7F);
|
||||
|
||||
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = chartGrid;
|
||||
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = chartGrid;
|
||||
chart.ChartAreas[0].AxisX.LineColor = chartGrid;
|
||||
chart.ChartAreas[0].AxisY.LineColor = chartGrid;
|
||||
|
||||
for (int i = 0; i <= 90; i += 10)
|
||||
chart.ChartAreas[0].AxisY.CustomLabels.Add(i - 2, i + 2, ChartPercToRPM(i));
|
||||
|
||||
chart.ChartAreas[0].AxisY.CustomLabels.Add(98, 102, "RPM");
|
||||
chart.ChartAreas[0].AxisY.CustomLabels.Add(98, 102, Properties.Strings.RPM);
|
||||
|
||||
chart.ChartAreas[0].AxisY.Interval = 10;
|
||||
|
||||
@@ -80,56 +253,10 @@ namespace GHelper
|
||||
Left = Program.settingsForm.Left - Width - 5;
|
||||
}
|
||||
|
||||
public Fans()
|
||||
|
||||
private void TrackPower_MouseUp(object? sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
labelTip.Visible = false;
|
||||
labelTip.BackColor = Color.Transparent;
|
||||
|
||||
FormClosing += Fans_FormClosing;
|
||||
|
||||
seriesCPU = chartCPU.Series.Add("CPU");
|
||||
seriesGPU = chartGPU.Series.Add("GPU");
|
||||
|
||||
seriesCPU.Color = Color.Blue;
|
||||
seriesGPU.Color = Color.Red;
|
||||
|
||||
chartCPU.MouseMove += ChartCPU_MouseMove;
|
||||
chartCPU.MouseUp += ChartCPU_MouseUp;
|
||||
|
||||
chartGPU.MouseMove += ChartCPU_MouseMove;
|
||||
chartGPU.MouseUp += ChartCPU_MouseUp;
|
||||
|
||||
buttonReset.Click += ButtonReset_Click;
|
||||
buttonApply.Click += ButtonApply_Click;
|
||||
|
||||
trackTotal.Maximum = ASUSWmi.MaxTotal;
|
||||
trackTotal.Minimum = ASUSWmi.MinTotal;
|
||||
|
||||
trackCPU.Maximum = ASUSWmi.MaxCPU;
|
||||
trackCPU.Minimum = ASUSWmi.MinCPU;
|
||||
|
||||
trackCPU.Scroll += TrackCPU_Scroll;
|
||||
trackTotal.Scroll += TrackTotal_Scroll;
|
||||
|
||||
buttonApplyPower.Click += ButtonApplyPower_Click;
|
||||
|
||||
checkAuto.Click += CheckAuto_Click;
|
||||
checkApplyPower.Click += CheckApplyPower_Click;
|
||||
|
||||
//labelInfo.MaximumSize = new Size(280, 0);
|
||||
labelInfo.Text = "Power Limits (PPT) is\nexperimental feature.\n\nUse carefully and\non your own risk!";
|
||||
|
||||
InitFans();
|
||||
InitPower();
|
||||
InitBoost();
|
||||
|
||||
comboBoost.SelectedIndexChanged += ComboBoost_Changed;
|
||||
|
||||
Shown += Fans_Shown;
|
||||
|
||||
Program.settingsForm.AutoPower();
|
||||
}
|
||||
|
||||
|
||||
@@ -142,9 +269,11 @@ namespace GHelper
|
||||
|
||||
private void ComboBoost_Changed(object? sender, EventArgs e)
|
||||
{
|
||||
if (sender is null) return;
|
||||
ComboBox cmb = (ComboBox)sender;
|
||||
NativeMethods.SetCPUBoost(cmb.SelectedIndex);
|
||||
if (Program.config.getConfigPerf("auto_boost") != comboBoost.SelectedIndex)
|
||||
{
|
||||
NativeMethods.SetCPUBoost(comboBoost.SelectedIndex);
|
||||
Program.config.setConfigPerf("auto_boost", comboBoost.SelectedIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckApplyPower_Click(object? sender, EventArgs e)
|
||||
@@ -152,29 +281,55 @@ namespace GHelper
|
||||
if (sender is null) return;
|
||||
CheckBox chk = (CheckBox)sender;
|
||||
Program.config.setConfigPerf("auto_apply_power", chk.Checked ? 1 : 0);
|
||||
|
||||
if (chk.Checked)
|
||||
{
|
||||
Program.settingsForm.AutoPower();
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, Program.config.getConfig("performance_mode"), "PerfMode");
|
||||
Program.settingsForm.AutoFans();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void CheckAuto_Click(object? sender, EventArgs e)
|
||||
private void CheckApplyFans_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (sender is null) return;
|
||||
CheckBox chk = (CheckBox)sender;
|
||||
|
||||
Program.config.setConfigPerf("auto_apply", chk.Checked ? 1 : 0);
|
||||
|
||||
if (chk.Checked)
|
||||
{
|
||||
Program.settingsForm.AutoFans();
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, Program.config.getConfig("performance_mode"), "PerfMode");
|
||||
Program.settingsForm.AutoPower();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void LabelFansResult(string text)
|
||||
{
|
||||
labelFansResult.Text = text;
|
||||
labelFansResult.Visible = (text.Length > 0);
|
||||
}
|
||||
|
||||
private void Fans_FormClosing(object? sender, FormClosingEventArgs e)
|
||||
{
|
||||
|
||||
/*
|
||||
if (e.CloseReason == CloseReason.UserClosing)
|
||||
{
|
||||
e.Cancel = true;
|
||||
Hide();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private void ButtonApplyPower_Click(object? sender, EventArgs e)
|
||||
{
|
||||
Program.settingsForm.SetPower();
|
||||
ApplyLabel(true);
|
||||
}
|
||||
|
||||
public void InitPower(bool changed = false)
|
||||
{
|
||||
@@ -182,13 +337,13 @@ namespace GHelper
|
||||
bool cpuBmode = (Program.wmi.DeviceGet(ASUSWmi.PPT_CPUB0) >= 0); // 2022 model +
|
||||
bool cpuAmode = (Program.wmi.DeviceGet(ASUSWmi.PPT_TotalA0) >= 0); // 2021 model +
|
||||
|
||||
panelPower.Visible = cpuAmode;
|
||||
panelSliders.Visible = cpuAmode;
|
||||
panelCPU.Visible = cpuBmode;
|
||||
|
||||
// Yes, that's stupid, but Total slider on 2021 model actually adjusts CPU PPT
|
||||
if (!cpuBmode)
|
||||
{
|
||||
label1.Text = "CPU SPPT";
|
||||
labelPlatform.Text = "CPU SPPT";
|
||||
}
|
||||
|
||||
int limit_total;
|
||||
@@ -199,13 +354,11 @@ namespace GHelper
|
||||
{
|
||||
limit_total = trackTotal.Value;
|
||||
limit_cpu = trackCPU.Value;
|
||||
ApplyLabel(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
limit_total = Program.config.getConfigPerf("limit_total");
|
||||
limit_cpu = Program.config.getConfigPerf("limit_cpu");
|
||||
ApplyLabel(apply);
|
||||
}
|
||||
|
||||
if (limit_total < 0) limit_total = ASUSWmi.DefaultTotal;
|
||||
@@ -223,42 +376,39 @@ namespace GHelper
|
||||
|
||||
labelTotal.Text = trackTotal.Value.ToString() + "W";
|
||||
labelCPU.Text = trackCPU.Value.ToString() + "W";
|
||||
pictureFine.Visible = (limit_cpu > 85 || limit_total > 145);
|
||||
|
||||
Program.config.setConfigPerf("limit_total", limit_total);
|
||||
Program.config.setConfigPerf("limit_cpu", limit_cpu);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void TrackTotal_Scroll(object? sender, EventArgs e)
|
||||
private void TrackPower_Scroll(object? sender, EventArgs e)
|
||||
{
|
||||
InitPower(true);
|
||||
}
|
||||
|
||||
private void TrackCPU_Scroll(object? sender, EventArgs e)
|
||||
{
|
||||
InitPower(true);
|
||||
}
|
||||
|
||||
|
||||
public void ApplyLabel(bool applied = false)
|
||||
{
|
||||
if (applied)
|
||||
{
|
||||
labelApplied.ForeColor = Color.Blue;
|
||||
labelApplied.Text = "Applied";
|
||||
}
|
||||
else
|
||||
{
|
||||
labelApplied.ForeColor = Color.Red;
|
||||
labelApplied.Text = "Not Applied";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void InitFans()
|
||||
{
|
||||
|
||||
byte[] curve = Program.wmi.GetFanCurve(2);
|
||||
|
||||
if (curve.All(singleByte => singleByte == 0))
|
||||
{
|
||||
Program.config.setConfig("mid_fan", 0);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.config.setConfig("mid_fan", 1);
|
||||
chartMid.Visible = true;
|
||||
SetChart(chartMid, 2);
|
||||
LoadProfile(seriesMid, 2);
|
||||
}
|
||||
|
||||
|
||||
SetChart(chartCPU, 0);
|
||||
SetChart(chartGPU, 1);
|
||||
|
||||
@@ -267,7 +417,7 @@ namespace GHelper
|
||||
|
||||
int auto_apply = Program.config.getConfigPerf("auto_apply");
|
||||
|
||||
checkAuto.Checked = (auto_apply == 1);
|
||||
checkApplyFans.Checked = (auto_apply == 1);
|
||||
|
||||
}
|
||||
|
||||
@@ -300,9 +450,11 @@ namespace GHelper
|
||||
old = curve[i];
|
||||
}
|
||||
|
||||
SaveProfile(series, device);
|
||||
|
||||
}
|
||||
|
||||
void ApplyProfile(Series series, int device)
|
||||
void SaveProfile(Series series, int device)
|
||||
{
|
||||
byte[] curve = new byte[16];
|
||||
int i = 0;
|
||||
@@ -314,95 +466,182 @@ namespace GHelper
|
||||
}
|
||||
|
||||
Program.config.setFanConfig(device, curve);
|
||||
Program.wmi.SetFanCurve(device, curve);
|
||||
//Program.wmi.SetFanCurve(device, curve);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void ButtonApply_Click(object? sender, EventArgs e)
|
||||
{
|
||||
ApplyProfile(seriesCPU, 0);
|
||||
ApplyProfile(seriesGPU, 1);
|
||||
}
|
||||
|
||||
private void ButtonReset_Click(object? sender, EventArgs e)
|
||||
{
|
||||
|
||||
LoadProfile(seriesCPU, 0, 1);
|
||||
LoadProfile(seriesGPU, 1, 1);
|
||||
if (Program.config.getConfig("mid_fan") == 1)
|
||||
LoadProfile(seriesMid, 2, 1);
|
||||
|
||||
checkAuto.Checked = false;
|
||||
checkApplyFans.Checked = false;
|
||||
checkApplyPower.Checked = false;
|
||||
|
||||
Program.config.setConfigPerf("auto_apply", 0);
|
||||
Program.config.setConfigPerf("auto_apply_power", 0);
|
||||
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, Program.config.getConfig("performance_mode"));
|
||||
|
||||
ApplyLabel(false);
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, Program.config.getConfig("performance_mode"), "PerfMode");
|
||||
}
|
||||
|
||||
private void ChartCPU_MouseUp(object? sender, MouseEventArgs e)
|
||||
{
|
||||
curPoint = null;
|
||||
labelTip.Visible = false;
|
||||
|
||||
SaveProfile(seriesCPU, 0);
|
||||
SaveProfile(seriesGPU, 1);
|
||||
if (Program.config.getConfig("mid_fan") == 1)
|
||||
SaveProfile(seriesMid, 2);
|
||||
|
||||
Program.settingsForm.AutoFans();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void ChartCPU_MouseMove(object? sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
if (sender is null) return;
|
||||
|
||||
Chart chart = (Chart)sender;
|
||||
|
||||
if (e.Button.HasFlag(MouseButtons.Left))
|
||||
ChartArea ca = chart.ChartAreas[0];
|
||||
Axis ax = ca.AxisX;
|
||||
Axis ay = ca.AxisY;
|
||||
|
||||
bool tip = false;
|
||||
|
||||
HitTestResult hit = chart.HitTest(e.X, e.Y);
|
||||
if (hit.Series is not null && hit.PointIndex >= 0)
|
||||
{
|
||||
ChartArea ca = chart.ChartAreas[0];
|
||||
Axis ax = ca.AxisX;
|
||||
Axis ay = ca.AxisY;
|
||||
|
||||
HitTestResult hit = chart.HitTest(e.X, e.Y);
|
||||
if (hit.Series is not null && hit.PointIndex >= 0)
|
||||
curPoint = hit.Series.Points[hit.PointIndex];
|
||||
curPoint = hit.Series.Points[hit.PointIndex];
|
||||
tip = true;
|
||||
}
|
||||
|
||||
|
||||
if (curPoint != null)
|
||||
if (curPoint != null)
|
||||
{
|
||||
|
||||
double dx, dy, dymin;
|
||||
|
||||
try
|
||||
{
|
||||
dx = ax.PixelPositionToValue(e.X);
|
||||
dy = ay.PixelPositionToValue(e.Y);
|
||||
|
||||
Series s = hit.Series;
|
||||
double dx, dy, dymin;
|
||||
if (dx < 20) dx = 20;
|
||||
if (dx > 100) dx = 100;
|
||||
|
||||
try
|
||||
if (dy < 0) dy = 0;
|
||||
if (dy > 100) dy = 100;
|
||||
|
||||
dymin = (dx - 65) * 1.2;
|
||||
|
||||
if (dy < dymin) dy = dymin;
|
||||
|
||||
if (e.Button.HasFlag(MouseButtons.Left))
|
||||
{
|
||||
dx = ax.PixelPositionToValue(e.X);
|
||||
dy = ay.PixelPositionToValue(e.Y);
|
||||
|
||||
if (dx < 20) dx = 20;
|
||||
if (dx > 100) dx = 100;
|
||||
|
||||
if (dy < 0) dy = 0;
|
||||
if (dy > 100) dy = 100;
|
||||
|
||||
dymin = (dx - 65) * 1.2;
|
||||
|
||||
if (dy < dymin) dy = dymin;
|
||||
|
||||
curPoint.XValue = dx;
|
||||
curPoint.YValues[0] = dy;
|
||||
|
||||
labelTip.Visible = true;
|
||||
labelTip.Text = Math.Round(dx) + "C, " + ChartPercToRPM((int)dy, " RPM");
|
||||
labelTip.Top = e.Y + ((Control)sender).Top;
|
||||
labelTip.Left = e.X;
|
||||
if (hit.Series is not null)
|
||||
AdjustAllLevels(hit.PointIndex, dx, dy, hit.Series);
|
||||
|
||||
tip = true;
|
||||
}
|
||||
catch
|
||||
|
||||
labelTip.Text = Math.Round(curPoint.XValue) + "C, " + ChartPercToRPM((int)curPoint.YValues[0], " " + Properties.Strings.RPM);
|
||||
labelTip.Top = e.Y + ((Control)sender).Top;
|
||||
labelTip.Left = e.X - 50;
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.WriteLine(e.Y);
|
||||
tip = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
labelTip.Visible = tip;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void AdjustAllLevels(int index, double curXVal, double curYVal, Series series)
|
||||
{
|
||||
|
||||
// Get the neighboring DataPoints of the hit point
|
||||
DataPoint upperPoint = null;
|
||||
DataPoint lowerPoint = null;
|
||||
|
||||
if (index > 0)
|
||||
{
|
||||
lowerPoint = series.Points[index - 1];
|
||||
}
|
||||
|
||||
if (index < series.Points.Count - 1)
|
||||
{
|
||||
upperPoint = series.Points[index + 1];
|
||||
}
|
||||
|
||||
// Adjust the values according to the comparison between the value and its neighbors
|
||||
if (upperPoint != null)
|
||||
{
|
||||
if (curYVal > upperPoint.YValues[0])
|
||||
{
|
||||
|
||||
for (int i = index + 1; i < series.Points.Count; i++)
|
||||
{
|
||||
Debug.WriteLine(e.Y);
|
||||
DataPoint curUpper = series.Points[i];
|
||||
if (curUpper.YValues[0] >= curYVal) break;
|
||||
|
||||
curUpper.YValues[0] = curYVal;
|
||||
}
|
||||
}
|
||||
if (curXVal > upperPoint.XValue)
|
||||
{
|
||||
|
||||
for (int i = index + 1; i < series.Points.Count; i++)
|
||||
{
|
||||
DataPoint curUpper = series.Points[i];
|
||||
if (curUpper.XValue >= curXVal) break;
|
||||
|
||||
curUpper.XValue = curXVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lowerPoint != null)
|
||||
{
|
||||
//Debug.WriteLine(curYVal + " <? " + Math.Floor(lowerPoint.YValues[0]));
|
||||
if (curYVal <= Math.Floor(lowerPoint.YValues[0]))
|
||||
{
|
||||
for (int i = index - 1; i >= 0; i--)
|
||||
{
|
||||
DataPoint curLower = series.Points[i];
|
||||
if (curLower.YValues[0] < curYVal) break;
|
||||
curLower.YValues[0] = Math.Floor(curYVal);
|
||||
}
|
||||
}
|
||||
if (curXVal < lowerPoint.XValue)
|
||||
{
|
||||
|
||||
for (int i = index - 1; i >= 0; i--)
|
||||
{
|
||||
DataPoint curLower = series.Points[i];
|
||||
if (curLower.XValue <= curXVal) break;
|
||||
|
||||
curLower.XValue = curXVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,10 +13,26 @@
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<SupportedOSPlatformVersion>8.0</SupportedOSPlatformVersion>
|
||||
<AssemblyName>GHelper</AssemblyName>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>0.31</AssemblyVersion>
|
||||
<AssemblyVersion>0.58</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -45,19 +61,9 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="hidlibrary" Version="3.3.40" />
|
||||
<PackageReference Include="HidSharpCore" Version="1.2.1.1" />
|
||||
<PackageReference Include="NvAPIWrapper.Net" Version="0.8.1.101" />
|
||||
<PackageReference Include="System.Management" Version="7.0.0" />
|
||||
<PackageReference Include="System.Management" Version="7.0.1" />
|
||||
<PackageReference Include="TaskScheduler" Version="2.10.1" />
|
||||
<PackageReference Include="WinForms.DataVisualization" Version="1.7.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Management.Infrastructure">
|
||||
<HintPath>..\..\.nuget\packages\microsoft.management.infrastructure\2.0.0\ref\net451\Microsoft.Management.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Management.Infrastructure.Native">
|
||||
<HintPath>..\..\.nuget\packages\microsoft.management.infrastructure.runtime.win\2.0.0\runtimes\win10-x64\lib\netstandard1.6\Microsoft.Management.Infrastructure.Native.dll</HintPath>
|
||||
</Reference>
|
||||
<PackageReference Include="WinForms.DataVisualization" Version="1.8.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -87,6 +93,11 @@
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Properties\Strings.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Strings.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Properties\Settings.Designer.cs">
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<AutoGen>True</AutoGen>
|
||||
@@ -95,6 +106,20 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.uk.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Properties\Resources.uk.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Properties\Strings.uk.resx">
|
||||
<LastGenOutput>Strings.uk.Designer.cs</LastGenOutput>
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Properties\Strings.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
|
||||
@@ -20,8 +20,8 @@ Global
|
||||
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 = Release|x64
|
||||
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Debug|x64.Build.0 = Release|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}.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
|
||||
|
||||
@@ -4,12 +4,15 @@ using AmdAdl2;
|
||||
namespace GHelper.Gpu;
|
||||
|
||||
// Reference: https://github.com/GPUOpen-LibrariesAndSDKs/display-library/blob/master/Sample-Managed/Program.cs
|
||||
public class AmdGpuTemperatureProvider : IGpuTemperatureProvider {
|
||||
public class AmdGpuControl : IGpuControl {
|
||||
private bool _isReady;
|
||||
private IntPtr _adlContextHandle;
|
||||
private readonly ADLAdapterInfo _internalDiscreteAdapter;
|
||||
|
||||
public AmdGpuTemperatureProvider() {
|
||||
public bool IsNvidia => false;
|
||||
|
||||
|
||||
public AmdGpuControl() {
|
||||
if (!Adl2.Load())
|
||||
return;
|
||||
|
||||
@@ -73,6 +76,24 @@ public class AmdGpuTemperatureProvider : IGpuTemperatureProvider {
|
||||
return temperatureSensor.Value;
|
||||
}
|
||||
|
||||
|
||||
public int? GetGpuUse()
|
||||
{
|
||||
if (!IsValid)
|
||||
return null;
|
||||
|
||||
if (Adl2.NativeMethods.ADL2_New_QueryPMLogData_Get(_adlContextHandle, _internalDiscreteAdapter.AdapterIndex, out ADLPMLogDataOutput adlpmLogDataOutput) != Adl2.ADL_SUCCESS)
|
||||
return null;
|
||||
|
||||
ADLSingleSensorData gpuUsage = adlpmLogDataOutput.Sensors[(int)ADLSensorType.PMLOG_INFO_ACTIVITY_GFX];
|
||||
if (gpuUsage.Supported == 0)
|
||||
return null;
|
||||
|
||||
return gpuUsage.Value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void ReleaseUnmanagedResources() {
|
||||
if (_adlContextHandle != IntPtr.Zero) {
|
||||
Adl2.NativeMethods.ADL2_Main_Control_Destroy(_adlContextHandle);
|
||||
@@ -86,7 +107,7 @@ public class AmdGpuTemperatureProvider : IGpuTemperatureProvider {
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
~AmdGpuTemperatureProvider() {
|
||||
~AmdGpuControl() {
|
||||
ReleaseUnmanagedResources();
|
||||
}
|
||||
}
|
||||
8
app/Gpu/IGpuControl.cs
Normal file
8
app/Gpu/IGpuControl.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace GHelper.Gpu;
|
||||
|
||||
public interface IGpuControl : IDisposable {
|
||||
bool IsNvidia { get; }
|
||||
bool IsValid { get; }
|
||||
int? GetCurrentTemperature();
|
||||
int? GetGpuUse();
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace GHelper.Gpu;
|
||||
|
||||
public interface IGpuTemperatureProvider : IDisposable {
|
||||
bool IsValid { get; }
|
||||
int? GetCurrentTemperature();
|
||||
}
|
||||
132
app/Gpu/NvidiaGpuControl.cs
Normal file
132
app/Gpu/NvidiaGpuControl.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using NvAPIWrapper.GPU;
|
||||
using NvAPIWrapper.Native;
|
||||
using NvAPIWrapper.Native.GPU;
|
||||
using NvAPIWrapper.Native.GPU.Structures;
|
||||
using NvAPIWrapper.Native.Interfaces.GPU;
|
||||
using static NvAPIWrapper.Native.GPU.Structures.PerformanceStates20InfoV1;
|
||||
|
||||
namespace GHelper.Gpu;
|
||||
|
||||
public class NvidiaGpuControl : IGpuControl
|
||||
{
|
||||
|
||||
public const int MaxCoreOffset = 250;
|
||||
public const int MaxMemoryOffset = 250;
|
||||
|
||||
public const int MinCoreOffset = -250;
|
||||
public const int MinMemoryOffset = -250;
|
||||
|
||||
private readonly PhysicalGPU? _internalGpu;
|
||||
|
||||
public NvidiaGpuControl()
|
||||
{
|
||||
_internalGpu = GetInternalDiscreteGpu();
|
||||
}
|
||||
|
||||
public bool IsValid => _internalGpu != null;
|
||||
|
||||
public bool IsNvidia => IsValid;
|
||||
|
||||
public int? GetCurrentTemperature()
|
||||
{
|
||||
if (!IsValid)
|
||||
return null;
|
||||
|
||||
PhysicalGPU internalGpu = _internalGpu!;
|
||||
IThermalSensor? gpuSensor =
|
||||
GPUApi.GetThermalSettings(internalGpu.Handle).Sensors
|
||||
.FirstOrDefault(s => s.Target == ThermalSettingsTarget.GPU);
|
||||
|
||||
return gpuSensor?.CurrentTemperature;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void GetClocks(out int core, out int memory)
|
||||
{
|
||||
PhysicalGPU internalGpu = _internalGpu!;
|
||||
Logger.WriteLine(internalGpu.FullName);
|
||||
Logger.WriteLine(internalGpu.ArchitectInformation.ToString());
|
||||
|
||||
IPerformanceStates20Info states = GPUApi.GetPerformanceStates20(internalGpu.Handle);
|
||||
|
||||
Logger.WriteLine("IPerformanceStates20Info type : " + states.GetType());
|
||||
|
||||
core = states.Clocks[PerformanceStateId.P0_3DPerformance][0].FrequencyDeltaInkHz.DeltaValue / 1000;
|
||||
memory = states.Clocks[PerformanceStateId.P0_3DPerformance][1].FrequencyDeltaInkHz.DeltaValue / 1000;
|
||||
}
|
||||
|
||||
public int SetClocksFromConfig()
|
||||
{
|
||||
int core = Program.config.getConfig("gpu_core");
|
||||
int memory = Program.config.getConfig("gpu_memory");
|
||||
int status = SetClocks(core, memory);
|
||||
return status;
|
||||
}
|
||||
|
||||
public int SetClocks(int core, int memory)
|
||||
{
|
||||
|
||||
if (core < MinCoreOffset || core > MaxCoreOffset) return 0;
|
||||
if (memory < MinMemoryOffset || memory > MaxMemoryOffset) return 0;
|
||||
|
||||
PhysicalGPU internalGpu = _internalGpu!;
|
||||
|
||||
var coreClock = new PerformanceStates20ClockEntryV1(PublicClockDomain.Graphics, new PerformanceStates20ParameterDelta(core * 1000));
|
||||
var memoryClock = new PerformanceStates20ClockEntryV1(PublicClockDomain.Memory, new PerformanceStates20ParameterDelta(memory * 1000));
|
||||
|
||||
PerformanceStates20ClockEntryV1[] clocks = { coreClock , memoryClock};
|
||||
PerformanceStates20BaseVoltageEntryV1[] voltages = { };
|
||||
|
||||
PerformanceState20[] performanceStates = { new PerformanceState20(PerformanceStateId.P0_3DPerformance, clocks, voltages) };
|
||||
|
||||
var overclock = new PerformanceStates20InfoV1(performanceStates, 2, 0);
|
||||
|
||||
try
|
||||
{
|
||||
GPUApi.SetPerformanceStates20(internalGpu.Handle, overclock);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.ToString());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static PhysicalGPU? GetInternalDiscreteGpu()
|
||||
{
|
||||
try
|
||||
{
|
||||
return PhysicalGPU
|
||||
.GetPhysicalGPUs()
|
||||
.FirstOrDefault(gpu => gpu.SystemType == SystemType.Laptop);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.ToString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int? GetGpuUse()
|
||||
{
|
||||
if (!IsValid)
|
||||
return null;
|
||||
|
||||
PhysicalGPU internalGpu = _internalGpu!;
|
||||
IUtilizationDomainInfo? gpuUsage = GPUApi.GetUsages(internalGpu.Handle).GPU;
|
||||
|
||||
return (int?)gpuUsage?.Percentage;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
using NvAPIWrapper.GPU;
|
||||
using NvAPIWrapper.Native;
|
||||
using NvAPIWrapper.Native.Exceptions;
|
||||
using NvAPIWrapper.Native.GPU;
|
||||
using NvAPIWrapper.Native.Interfaces.GPU;
|
||||
|
||||
namespace GHelper.Gpu;
|
||||
|
||||
public class NvidiaGpuTemperatureProvider : IGpuTemperatureProvider {
|
||||
private readonly PhysicalGPU? _internalGpu;
|
||||
|
||||
public NvidiaGpuTemperatureProvider() {
|
||||
_internalGpu = GetInternalDiscreteGpu();
|
||||
}
|
||||
|
||||
public bool IsValid => _internalGpu != null;
|
||||
|
||||
public int? GetCurrentTemperature() {
|
||||
if (!IsValid)
|
||||
return null;
|
||||
|
||||
PhysicalGPU internalGpu = _internalGpu!;
|
||||
IThermalSensor? gpuSensor =
|
||||
GPUApi.GetThermalSettings(internalGpu.Handle).Sensors
|
||||
.FirstOrDefault(s => s.Target == ThermalSettingsTarget.GPU);
|
||||
|
||||
return gpuSensor?.CurrentTemperature;
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
}
|
||||
|
||||
private static PhysicalGPU? GetInternalDiscreteGpu() {
|
||||
try {
|
||||
return PhysicalGPU
|
||||
.GetPhysicalGPUs()
|
||||
.FirstOrDefault(gpu => gpu.SystemType == SystemType.Laptop);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,86 +1,176 @@
|
||||
using System.Diagnostics;
|
||||
using GHelper;
|
||||
using GHelper.Gpu;
|
||||
using System.Diagnostics;
|
||||
|
||||
public static class HardwareMonitor
|
||||
{
|
||||
private static IGpuTemperatureProvider? GpuTemperatureProvider;
|
||||
public static IGpuControl? GpuControl;
|
||||
|
||||
public static float? cpuTemp = -1;
|
||||
public static float? batteryDischarge = -1;
|
||||
public static int? gpuTemp = null;
|
||||
|
||||
public static void ReadSensors()
|
||||
public static string? cpuFan;
|
||||
public static string? gpuFan;
|
||||
public static string? midFan;
|
||||
|
||||
public static int? gpuUse;
|
||||
|
||||
public static int GetFanMax()
|
||||
{
|
||||
cpuTemp = -1;
|
||||
batteryDischarge = -1;
|
||||
|
||||
try
|
||||
{
|
||||
var ct = new PerformanceCounter("Thermal Zone Information", "Temperature", @"\_TZ.THRM", true);
|
||||
cpuTemp = ct.NextValue() - 273;
|
||||
ct.Dispose();
|
||||
} catch
|
||||
{
|
||||
Logger.WriteLine("Failed reading CPU temp");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var cb = new PerformanceCounter("Power Meter", "Power", "Power Meter (0)", true);
|
||||
batteryDischarge = cb.NextValue() / 1000;
|
||||
cb.Dispose();
|
||||
|
||||
} catch
|
||||
{
|
||||
Logger.WriteLine("Failed reading Battery discharge");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
gpuTemp = GpuTemperatureProvider?.GetCurrentTemperature();
|
||||
} catch (Exception ex) {
|
||||
gpuTemp = null;
|
||||
Logger.WriteLine("Failed reading GPU temp");
|
||||
Logger.WriteLine(ex.ToString());
|
||||
}
|
||||
|
||||
int max = 58;
|
||||
if (Program.config.ContainsModel("401")) max = 72;
|
||||
else if (Program.config.ContainsModel("503")) max = 68;
|
||||
return Math.Max(max, Program.config.getConfig("fan_max"));
|
||||
}
|
||||
|
||||
public static void RecreateGpuTemperatureProviderWithRetry() {
|
||||
RecreateGpuTemperatureProvider();
|
||||
public static void SetFanMax(int fan)
|
||||
{
|
||||
Program.config.setConfig("fan_max", fan);
|
||||
}
|
||||
private static string FormatFan(int fan)
|
||||
{
|
||||
// fix for old models
|
||||
if (fan < 0)
|
||||
{
|
||||
fan += 65536;
|
||||
if (fan <= 0 || fan > 100) return null; //nothing reasonable
|
||||
}
|
||||
|
||||
int fanMax = GetFanMax();
|
||||
if (fan > fanMax) SetFanMax(fan);
|
||||
|
||||
if (Program.config.getConfig("fan_rpm") == 1)
|
||||
return " Fan: " + (fan * 100).ToString() + "RPM";
|
||||
else
|
||||
return " Fan: " + Math.Min(Math.Round((float)fan / fanMax * 100), 100).ToString() + "%"; // relatively to 6000 rpm
|
||||
}
|
||||
|
||||
private static int GetGpuUse()
|
||||
{
|
||||
try
|
||||
{
|
||||
int? gpuUse = GpuControl?.GetGpuUse();
|
||||
if (gpuUse is not null) return (int)gpuUse;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.ToString());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public static void ReadSensors()
|
||||
{
|
||||
batteryDischarge = -1;
|
||||
gpuTemp = -1;
|
||||
gpuUse = -1;
|
||||
|
||||
cpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan));
|
||||
gpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan));
|
||||
midFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.Mid_Fan));
|
||||
|
||||
cpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_CPU);
|
||||
|
||||
if (cpuTemp < 0) try
|
||||
{
|
||||
using (var ct = new PerformanceCounter("Thermal Zone Information", "Temperature", @"\_TZ.THRM", true))
|
||||
{
|
||||
cpuTemp = ct.NextValue() - 273;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.WriteLine("Failed reading CPU temp");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
gpuTemp = GpuControl?.GetCurrentTemperature();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
gpuTemp = -1;
|
||||
Debug.WriteLine("Failed reading GPU temp");
|
||||
Debug.WriteLine(ex.ToString());
|
||||
}
|
||||
|
||||
if (gpuTemp is null || gpuTemp < 0)
|
||||
gpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_GPU);
|
||||
|
||||
try
|
||||
{
|
||||
using (var cb = new PerformanceCounter("Power Meter", "Power", "Power Meter (0)", true))
|
||||
{
|
||||
batteryDischarge = cb.NextValue() / 1000;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.WriteLine("Failed reading Battery discharge");
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsUsedGPU(int threshold = 20)
|
||||
{
|
||||
if (GetGpuUse() > threshold)
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
return (GetGpuUse() > threshold);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void RecreateGpuControlWithDelay(int delay = 5)
|
||||
{
|
||||
|
||||
// Re-enabling the discrete GPU takes a bit of time,
|
||||
// so a simple workaround is to refresh again after that happens
|
||||
Task.Run(async () => {
|
||||
await Task.Delay(TimeSpan.FromSeconds(3));
|
||||
RecreateGpuTemperatureProvider();
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromSeconds(delay));
|
||||
RecreateGpuControl();
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void RecreateGpuTemperatureProvider() {
|
||||
try {
|
||||
GpuTemperatureProvider?.Dispose();
|
||||
public static void RecreateGpuControl()
|
||||
{
|
||||
try
|
||||
{
|
||||
GpuControl?.Dispose();
|
||||
|
||||
// Detect valid GPU temperature provider.
|
||||
// We start with NVIDIA because there's always at least an integrated AMD GPU
|
||||
IGpuTemperatureProvider gpuTemperatureProvider = new NvidiaGpuTemperatureProvider();
|
||||
if (gpuTemperatureProvider.IsValid) {
|
||||
GpuTemperatureProvider = gpuTemperatureProvider;
|
||||
IGpuControl _gpuControl = new NvidiaGpuControl();
|
||||
if (_gpuControl.IsValid)
|
||||
{
|
||||
GpuControl = _gpuControl;
|
||||
return;
|
||||
}
|
||||
|
||||
gpuTemperatureProvider.Dispose();
|
||||
gpuTemperatureProvider = new AmdGpuTemperatureProvider();
|
||||
if (gpuTemperatureProvider.IsValid) {
|
||||
GpuTemperatureProvider = gpuTemperatureProvider;
|
||||
|
||||
_gpuControl.Dispose();
|
||||
|
||||
/*
|
||||
_gpuControl = new AmdGpuControl();
|
||||
if (_gpuControl.IsValid)
|
||||
{
|
||||
GpuControl = _gpuControl;
|
||||
return;
|
||||
}
|
||||
|
||||
gpuTemperatureProvider.Dispose();
|
||||
|
||||
GpuTemperatureProvider = null;
|
||||
} finally {
|
||||
Logger.WriteLine($"GpuTemperatureProvider: {GpuTemperatureProvider?.GetType().Name}");
|
||||
_gpuControl.Dispose();
|
||||
*/
|
||||
|
||||
GpuControl = null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
public static class HighDpiHelper
|
||||
{
|
||||
public static void AdjustControlImagesDpiScale(Control container, float baseScale = 2)
|
||||
{
|
||||
var dpiScale = GetDpiScale(container).Value;
|
||||
AdjustControlImagesDpiScale(container.Controls, dpiScale / baseScale);
|
||||
}
|
||||
|
||||
public static void AdjustButtonDpiScale(ButtonBase button, float dpiScale)
|
||||
{
|
||||
var image = button.Image;
|
||||
|
||||
if (image == null)
|
||||
return;
|
||||
|
||||
button.Image = ScaleImage(image, dpiScale);
|
||||
}
|
||||
|
||||
private static void AdjustControlImagesDpiScale(Control.ControlCollection controls, float dpiScale)
|
||||
{
|
||||
foreach (Control control in controls)
|
||||
{
|
||||
var button = control as ButtonBase;
|
||||
if (button != null)
|
||||
AdjustButtonDpiScale(button, dpiScale);
|
||||
|
||||
AdjustControlImagesDpiScale(control.Controls, dpiScale);
|
||||
}
|
||||
}
|
||||
|
||||
public static Lazy<float> GetDpiScale(Control control)
|
||||
{
|
||||
return new Lazy<float>(() =>
|
||||
{
|
||||
using (var graphics = control.CreateGraphics())
|
||||
return graphics.DpiX / 96.0f;
|
||||
});
|
||||
}
|
||||
|
||||
private static Image ScaleImage(Image image, float dpiScale)
|
||||
{
|
||||
var newSize = ScaleSize(image.Size, dpiScale);
|
||||
var newBitmap = new Bitmap(newSize.Width, newSize.Height);
|
||||
|
||||
using (var g = Graphics.FromImage(newBitmap))
|
||||
{
|
||||
// According to this blog post http://blogs.msdn.com/b/visualstudio/archive/2014/03/19/improving-high-dpi-support-for-visual-studio-2013.aspx
|
||||
// NearestNeighbor is more adapted for 200% and 200%+ DPI
|
||||
|
||||
var interpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
if (dpiScale >= 2.0f)
|
||||
interpolationMode = InterpolationMode.NearestNeighbor;
|
||||
|
||||
g.InterpolationMode = interpolationMode;
|
||||
g.DrawImage(image, new Rectangle(new Point(), newSize));
|
||||
}
|
||||
|
||||
return newBitmap;
|
||||
}
|
||||
|
||||
private static Size ScaleSize(Size size, float scale)
|
||||
{
|
||||
return new Size((int)(size.Width * scale), (int)(size.Height * scale));
|
||||
}
|
||||
}
|
||||
173
app/Keyboard.Designer.cs
generated
173
app/Keyboard.Designer.cs
generated
@@ -1,173 +0,0 @@
|
||||
namespace GHelper
|
||||
{
|
||||
partial class Keyboard
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
groupBox1 = new GroupBox();
|
||||
textM4 = new TextBox();
|
||||
textM3 = new TextBox();
|
||||
comboM4 = new ComboBox();
|
||||
labelM4 = new Label();
|
||||
comboM3 = new ComboBox();
|
||||
labelM3 = new Label();
|
||||
textFNF4 = new TextBox();
|
||||
comboFNF4 = new ComboBox();
|
||||
labelFNF4 = new Label();
|
||||
groupBox1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
groupBox1.Controls.Add(textFNF4);
|
||||
groupBox1.Controls.Add(comboFNF4);
|
||||
groupBox1.Controls.Add(labelFNF4);
|
||||
groupBox1.Controls.Add(textM4);
|
||||
groupBox1.Controls.Add(textM3);
|
||||
groupBox1.Controls.Add(comboM4);
|
||||
groupBox1.Controls.Add(labelM4);
|
||||
groupBox1.Controls.Add(comboM3);
|
||||
groupBox1.Controls.Add(labelM3);
|
||||
groupBox1.Dock = DockStyle.Top;
|
||||
groupBox1.Location = new Point(10, 10);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Size = new Size(751, 242);
|
||||
groupBox1.TabIndex = 0;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "Key Bindings";
|
||||
//
|
||||
// textM4
|
||||
//
|
||||
textM4.Location = new Point(411, 113);
|
||||
textM4.Name = "textM4";
|
||||
textM4.PlaceholderText = "action";
|
||||
textM4.Size = new Size(320, 39);
|
||||
textM4.TabIndex = 5;
|
||||
//
|
||||
// textM3
|
||||
//
|
||||
textM3.Location = new Point(411, 54);
|
||||
textM3.Name = "textM3";
|
||||
textM3.PlaceholderText = "notepad /p \"file.txt\"";
|
||||
textM3.Size = new Size(320, 39);
|
||||
textM3.TabIndex = 4;
|
||||
//
|
||||
// comboM4
|
||||
//
|
||||
comboM4.FormattingEnabled = true;
|
||||
comboM4.Items.AddRange(new object[] { "Performance Mode", "Open G-Helper window", "Custom" });
|
||||
comboM4.Location = new Point(93, 112);
|
||||
comboM4.Name = "comboM4";
|
||||
comboM4.Size = new Size(312, 40);
|
||||
comboM4.TabIndex = 3;
|
||||
//
|
||||
// labelM4
|
||||
//
|
||||
labelM4.AutoSize = true;
|
||||
labelM4.Location = new Point(25, 116);
|
||||
labelM4.Name = "labelM4";
|
||||
labelM4.Size = new Size(54, 32);
|
||||
labelM4.TabIndex = 2;
|
||||
labelM4.Text = "M4:";
|
||||
//
|
||||
// comboM3
|
||||
//
|
||||
comboM3.FormattingEnabled = true;
|
||||
comboM3.Items.AddRange(new object[] { "Default", "Volume Mute", "Play / Pause", "PrintScreen", "Toggle Aura", "Custom" });
|
||||
comboM3.Location = new Point(93, 54);
|
||||
comboM3.Name = "comboM3";
|
||||
comboM3.Size = new Size(312, 40);
|
||||
comboM3.TabIndex = 1;
|
||||
//
|
||||
// labelM3
|
||||
//
|
||||
labelM3.AutoSize = true;
|
||||
labelM3.Location = new Point(25, 58);
|
||||
labelM3.Name = "labelM3";
|
||||
labelM3.Size = new Size(54, 32);
|
||||
labelM3.TabIndex = 0;
|
||||
labelM3.Text = "M3:";
|
||||
//
|
||||
// textFNF4
|
||||
//
|
||||
textFNF4.Location = new Point(411, 176);
|
||||
textFNF4.Name = "textFNF4";
|
||||
textFNF4.PlaceholderText = "action";
|
||||
textFNF4.Size = new Size(320, 39);
|
||||
textFNF4.TabIndex = 8;
|
||||
//
|
||||
// comboFNF4
|
||||
//
|
||||
comboFNF4.FormattingEnabled = true;
|
||||
comboFNF4.Location = new Point(93, 175);
|
||||
comboFNF4.Name = "comboFNF4";
|
||||
comboFNF4.Size = new Size(312, 40);
|
||||
comboFNF4.TabIndex = 7;
|
||||
//
|
||||
// labelFNF4
|
||||
//
|
||||
labelFNF4.AutoSize = true;
|
||||
labelFNF4.Location = new Point(2, 178);
|
||||
labelFNF4.Name = "labelFNF4";
|
||||
labelFNF4.Size = new Size(90, 32);
|
||||
labelFNF4.TabIndex = 6;
|
||||
labelFNF4.Text = "FN+F4:";
|
||||
//
|
||||
// Keyboard
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(771, 858);
|
||||
Controls.Add(groupBox1);
|
||||
FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||
MaximizeBox = false;
|
||||
MdiChildrenMinimizedAnchorBottom = false;
|
||||
MinimizeBox = false;
|
||||
Name = "Keyboard";
|
||||
Padding = new Padding(10);
|
||||
ShowIcon = false;
|
||||
ShowInTaskbar = false;
|
||||
Text = "Keyboard";
|
||||
groupBox1.ResumeLayout(false);
|
||||
groupBox1.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBox1;
|
||||
private Label labelM3;
|
||||
private ComboBox comboM3;
|
||||
private ComboBox comboM4;
|
||||
private Label labelM4;
|
||||
private TextBox textM4;
|
||||
private TextBox textM3;
|
||||
private TextBox textFNF4;
|
||||
private ComboBox comboFNF4;
|
||||
private Label labelFNF4;
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
namespace GHelper
|
||||
{
|
||||
public partial class Keyboard : Form
|
||||
{
|
||||
|
||||
Dictionary<string, string> customActions = new Dictionary<string, string>
|
||||
{
|
||||
{"","--------------" },
|
||||
{"mute", "Volume Mute"},
|
||||
{"screenshot", "Screenshot"},
|
||||
{"play", "Play/Pause"},
|
||||
{"aura", "Aura"},
|
||||
{"ghelper", "Open GHelper"},
|
||||
{"custom", "Custom"}
|
||||
};
|
||||
|
||||
private void SetKeyCombo(ComboBox combo, TextBox txbox, string name)
|
||||
{
|
||||
if (name == "m4")
|
||||
customActions[""] = "Performance";
|
||||
|
||||
if (name == "fnf4")
|
||||
{
|
||||
customActions[""] = "Aura";
|
||||
customActions.Remove("aura");
|
||||
}
|
||||
|
||||
combo.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
combo.DataSource = new BindingSource(customActions, null);
|
||||
combo.DisplayMember = "Value";
|
||||
combo.ValueMember = "Key";
|
||||
|
||||
string action = Program.config.getConfigString(name);
|
||||
|
||||
combo.SelectedValue = (action is not null) ? action : "";
|
||||
if (combo.SelectedValue is null) combo.SelectedValue = "";
|
||||
|
||||
combo.SelectedValueChanged += delegate
|
||||
{
|
||||
if (combo.SelectedValue is not null)
|
||||
Program.config.setConfig(name, combo.SelectedValue.ToString());
|
||||
};
|
||||
|
||||
txbox.Text = Program.config.getConfigString(name + "_custom");
|
||||
txbox.TextChanged += delegate
|
||||
{
|
||||
Program.config.setConfig(name + "_custom", txbox.Text);
|
||||
};
|
||||
}
|
||||
|
||||
public Keyboard()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
SetKeyCombo(comboM3, textM3, "m3");
|
||||
SetKeyCombo(comboM4, textM4, "m4");
|
||||
SetKeyCombo(comboFNF4, textFNF4, "fnf4");
|
||||
|
||||
Shown += Keyboard_Shown;
|
||||
}
|
||||
|
||||
|
||||
private void Keyboard_Shown(object? sender, EventArgs e)
|
||||
{
|
||||
Top = Program.settingsForm.Top;
|
||||
Left = Program.settingsForm.Left - Width - 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,54 @@
|
||||
using System.ComponentModel;
|
||||
using GHelper;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using static Tools.ScreenInterrogatory;
|
||||
|
||||
namespace Tools
|
||||
{
|
||||
|
||||
public class KeyHandler
|
||||
{
|
||||
|
||||
public const int NOMOD = 0x0000;
|
||||
public const int ALT = 0x0001;
|
||||
public const int CTRL = 0x0002;
|
||||
public const int SHIFT = 0x0004;
|
||||
public const int WIN = 0x0008;
|
||||
|
||||
public const int WM_HOTKEY_MSG_ID = 0x0312;
|
||||
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vk);
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool UnregisterHotKey(IntPtr hWnd, int id);
|
||||
|
||||
private int modifier;
|
||||
private int key;
|
||||
private IntPtr hWnd;
|
||||
private int id;
|
||||
public KeyHandler(int modifier, Keys key, nint handle)
|
||||
{
|
||||
this.modifier = modifier;
|
||||
this.key = (int)key;
|
||||
this.hWnd = handle;
|
||||
id = this.GetHashCode();
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return modifier ^ key ^ hWnd.ToInt32();
|
||||
}
|
||||
public bool Register()
|
||||
{
|
||||
return RegisterHotKey(hWnd, id, modifier, key);
|
||||
}
|
||||
public bool Unregiser()
|
||||
{
|
||||
return UnregisterHotKey(hWnd, id);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ScreenInterrogatory
|
||||
{
|
||||
public const int ERROR_SUCCESS = 0;
|
||||
@@ -307,6 +351,33 @@ namespace Tools
|
||||
public class NativeMethods
|
||||
{
|
||||
|
||||
private const int WM_SYSCOMMAND = 0x0112;
|
||||
private const int SC_MONITORPOWER = 0xF170;
|
||||
private const int MONITOR_OFF = 2;
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
private static extern uint FormatMessage(uint dwFlags, IntPtr lpSource, uint dwMessageId, uint dwLanguageId, out string lpBuffer, uint nSize, IntPtr Arguments);
|
||||
|
||||
public static void TurnOffScreen(IntPtr handle)
|
||||
{
|
||||
IntPtr result = SendMessage(handle, WM_SYSCOMMAND, (IntPtr)SC_MONITORPOWER, (IntPtr)MONITOR_OFF);
|
||||
if (result == IntPtr.Zero)
|
||||
{
|
||||
int error = Marshal.GetLastWin32Error();
|
||||
string message = "";
|
||||
uint formatFlags = 0x00001000 | 0x00000200 | 0x00000100 | 0x00000080;
|
||||
uint formatResult = FormatMessage(formatFlags, IntPtr.Zero, (uint)error, 0, out message, 0, IntPtr.Zero);
|
||||
if (formatResult == 0)
|
||||
{
|
||||
message = "Unknown error.";
|
||||
}
|
||||
Logger.WriteLine($"Failed to turn off screen. Error code: {error}. {message}");
|
||||
}
|
||||
}
|
||||
|
||||
// Monitor Power detection
|
||||
|
||||
internal const uint DEVICE_NOTIFY_WINDOW_HANDLE = 0x0;
|
||||
@@ -588,7 +659,7 @@ public class NativeMethods
|
||||
return laptopScreen;
|
||||
}
|
||||
|
||||
public static int GetRefreshRate()
|
||||
public static int GetRefreshRate(bool max = false)
|
||||
{
|
||||
DEVMODE dm = CreateDevmode();
|
||||
|
||||
@@ -598,10 +669,23 @@ public class NativeMethods
|
||||
if (laptopScreen is null)
|
||||
return -1;
|
||||
|
||||
if (0 != NativeMethods.EnumDisplaySettingsEx(laptopScreen, NativeMethods.ENUM_CURRENT_SETTINGS, ref dm))
|
||||
if (max)
|
||||
{
|
||||
frequency = dm.dmDisplayFrequency;
|
||||
int i = 0;
|
||||
while (0 != NativeMethods.EnumDisplaySettingsEx(laptopScreen, i, ref dm))
|
||||
{
|
||||
if (dm.dmDisplayFrequency > frequency) frequency = dm.dmDisplayFrequency;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0 != NativeMethods.EnumDisplaySettingsEx(laptopScreen, NativeMethods.ENUM_CURRENT_SETTINGS, ref dm))
|
||||
{
|
||||
frequency = dm.dmDisplayFrequency;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return frequency;
|
||||
}
|
||||
@@ -618,6 +702,7 @@ public class NativeMethods
|
||||
{
|
||||
dm.dmDisplayFrequency = frequency;
|
||||
int iRet = NativeMethods.ChangeDisplaySettingsEx(laptopScreen, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
|
||||
Logger.WriteLine("Screen = " + frequency.ToString() + "Hz : " + (iRet == 0 ? "OK" : iRet));
|
||||
return iRet;
|
||||
}
|
||||
|
||||
@@ -660,7 +745,6 @@ public class NativeMethods
|
||||
|
||||
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
||||
|
||||
/*
|
||||
var hrDC = PowerWriteDCValueIndex(
|
||||
IntPtr.Zero,
|
||||
activeSchemeGuid,
|
||||
@@ -669,8 +753,14 @@ public class NativeMethods
|
||||
boost);
|
||||
|
||||
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
||||
*/
|
||||
|
||||
Logger.WriteLine("Boost " + boost);
|
||||
}
|
||||
|
||||
public static void SetPowerScheme(string scheme)
|
||||
{
|
||||
PowerSetActiveScheme(IntPtr.Zero, new Guid(scheme));
|
||||
PowerSetActiveOverlayScheme(new Guid(scheme));
|
||||
}
|
||||
|
||||
public static void SetPowerScheme(int mode)
|
||||
|
||||
481
app/NvAPIWrapper/DRS/DriverSettingsProfile.cs
Normal file
481
app/NvAPIWrapper/DRS/DriverSettingsProfile.cs
Normal file
@@ -0,0 +1,481 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NvAPIWrapper.Native;
|
||||
using NvAPIWrapper.Native.DRS;
|
||||
using NvAPIWrapper.Native.DRS.Structures;
|
||||
|
||||
namespace NvAPIWrapper.DRS
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a NVIDIA driver settings profile
|
||||
/// </summary>
|
||||
public class DriverSettingsProfile
|
||||
{
|
||||
internal DriverSettingsProfile(DRSProfileHandle handle, DriverSettingsSession parentSession)
|
||||
{
|
||||
Handle = handle;
|
||||
Session = parentSession;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of applications under this profile
|
||||
/// </summary>
|
||||
public IEnumerable<ProfileApplication> Applications
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid profile instance."
|
||||
);
|
||||
}
|
||||
|
||||
return DRSApi.EnumApplications(Session.Handle, Handle)
|
||||
.Select(application => new ProfileApplication(application, this));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the profile support value for GPU series
|
||||
/// </summary>
|
||||
public DRSGPUSupport GPUSupport
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid profile instance."
|
||||
);
|
||||
}
|
||||
|
||||
var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
|
||||
|
||||
return profileInfo.GPUSupport;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid profile instance."
|
||||
);
|
||||
}
|
||||
|
||||
var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
|
||||
profileInfo.GPUSupport = value;
|
||||
DRSApi.SetProfileInfo(Session.Handle, Handle, profileInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the profile handle
|
||||
/// </summary>
|
||||
public DRSProfileHandle Handle { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean value indicating if this profile is predefined
|
||||
/// </summary>
|
||||
public bool IsPredefined
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid profile instance."
|
||||
);
|
||||
}
|
||||
|
||||
var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
|
||||
|
||||
return profileInfo.IsPredefined;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean value indicating if this profile is valid and contains a non-zero handle
|
||||
/// </summary>
|
||||
public bool IsValid
|
||||
{
|
||||
get => !Handle.IsNull;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the profile
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid profile instance."
|
||||
);
|
||||
}
|
||||
|
||||
var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
|
||||
|
||||
return profileInfo.Name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of application registered under this profile
|
||||
/// </summary>
|
||||
public int NumberOfApplications
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid profile instance."
|
||||
);
|
||||
}
|
||||
|
||||
var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
|
||||
|
||||
return profileInfo.NumberOfApplications;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of settings under this profile
|
||||
/// </summary>
|
||||
public int NumberOfSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid profile instance."
|
||||
);
|
||||
}
|
||||
|
||||
var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
|
||||
|
||||
return profileInfo.NumberOfSettings;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the session that had queried this profile
|
||||
/// </summary>
|
||||
public DriverSettingsSession Session { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of settings under this profile
|
||||
/// </summary>
|
||||
public IEnumerable<ProfileSetting> Settings
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid profile instance."
|
||||
);
|
||||
}
|
||||
|
||||
return DRSApi.EnumSettings(Session.Handle, Handle).Select(setting => new ProfileSetting(setting));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new profile
|
||||
/// </summary>
|
||||
/// <param name="session">The session to create this profile in.</param>
|
||||
/// <param name="profileName">The name of the profile.</param>
|
||||
/// <param name="gpuSupport">The supported GPU series for this profile.</param>
|
||||
/// <returns>An instance of <see cref="DriverSettingsProfile" /> representing this newly created profile.</returns>
|
||||
public static DriverSettingsProfile CreateProfile(
|
||||
DriverSettingsSession session,
|
||||
string profileName,
|
||||
DRSGPUSupport? gpuSupport = null)
|
||||
{
|
||||
gpuSupport = gpuSupport ?? new DRSGPUSupport();
|
||||
var profileInfo = new DRSProfileV1(profileName, gpuSupport.Value);
|
||||
var profileHandle = DRSApi.CreateProfile(session.Handle, profileInfo);
|
||||
|
||||
return new DriverSettingsProfile(profileHandle, session);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
return "[Invalid]";
|
||||
}
|
||||
|
||||
if (IsPredefined)
|
||||
{
|
||||
return $"{Name} (Predefined)";
|
||||
}
|
||||
|
||||
return Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes this profile and makes this instance invalid.
|
||||
/// </summary>
|
||||
public void Delete()
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid profile instance."
|
||||
);
|
||||
}
|
||||
|
||||
DRSApi.DeleteProfile(Session.Handle, Handle);
|
||||
Handle = DRSProfileHandle.DefaultHandle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes an application by its name.
|
||||
/// </summary>
|
||||
/// <param name="applicationName">The name of the application to be deleted.</param>
|
||||
public void DeleteApplicationByName(string applicationName)
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid profile instance."
|
||||
);
|
||||
}
|
||||
|
||||
DRSApi.DeleteApplication(Session.Handle, Handle, applicationName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a setting by its identification number
|
||||
/// </summary>
|
||||
/// <param name="settingId">The identification number of the setting to be deleted.</param>
|
||||
public void DeleteSetting(uint settingId)
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid profile instance."
|
||||
);
|
||||
}
|
||||
|
||||
DRSApi.DeleteProfileSetting(Session.Handle, Handle, settingId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a setting by its known identification number.
|
||||
/// </summary>
|
||||
/// <param name="settingId">The known identification number of the setting to be deleted.</param>
|
||||
public void DeleteSetting(KnownSettingId settingId)
|
||||
{
|
||||
DeleteSetting(SettingInfo.GetSettingId(settingId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds an application by its name.
|
||||
/// </summary>
|
||||
/// <param name="applicationName">The name of the application to search for.</param>
|
||||
/// <returns>
|
||||
/// An instance of <see cref="ProfileApplication" /> if an application is found; otherwise <see langword="null" />
|
||||
/// .
|
||||
/// </returns>
|
||||
public ProfileApplication GetApplicationByName(string applicationName)
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid profile instance."
|
||||
);
|
||||
}
|
||||
|
||||
var application = DRSApi.GetApplicationInfo(Session.Handle, Handle, applicationName);
|
||||
|
||||
if (application == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ProfileApplication(application, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searches for a setting using its identification number.
|
||||
/// </summary>
|
||||
/// <param name="settingId">The identification number of the setting to search for.</param>
|
||||
/// <returns>An instance of <see cref="ProfileSetting" /> if a setting is found; otherwise <see langword="null" />.</returns>
|
||||
public ProfileSetting GetSetting(uint settingId)
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid profile instance."
|
||||
);
|
||||
}
|
||||
|
||||
var setting = DRSApi.GetSetting(Session.Handle, Handle, settingId);
|
||||
|
||||
if (setting == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ProfileSetting(setting.Value);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Searches for a setting using its known identification number.
|
||||
/// </summary>
|
||||
/// <param name="settingId">The known identification number of the setting to search for.</param>
|
||||
/// <returns>An instance of <see cref="ProfileSetting" /> if a setting is found; otherwise <see langword="null" />.</returns>
|
||||
public ProfileSetting GetSetting(KnownSettingId settingId)
|
||||
{
|
||||
return GetSetting(SettingInfo.GetSettingId(settingId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restores applications and settings of this profile to their default. This also deletes custom profiles resulting in
|
||||
/// their handles becoming invalid.
|
||||
/// </summary>
|
||||
public void RestoreDefaults()
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid profile instance."
|
||||
);
|
||||
}
|
||||
|
||||
var isPredefined = IsPredefined;
|
||||
DRSApi.RestoreDefaults(Session.Handle, Handle);
|
||||
|
||||
if (!isPredefined)
|
||||
{
|
||||
Handle = DRSProfileHandle.DefaultHandle;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restores a setting to its default value.
|
||||
/// </summary>
|
||||
/// <param name="settingId">The identification number of the setting.</param>
|
||||
public void RestoreSettingToDefault(uint settingId)
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid profile instance."
|
||||
);
|
||||
}
|
||||
|
||||
DRSApi.RestoreDefaults(Session.Handle, Handle, settingId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restores a setting to its default value.
|
||||
/// </summary>
|
||||
/// <param name="settingId">The known identification number of the setting.</param>
|
||||
public void RestoreSettingToDefault(KnownSettingId settingId)
|
||||
{
|
||||
RestoreSettingToDefault(SettingInfo.GetSettingId(settingId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a new value for a setting or creates a new setting and sets its value
|
||||
/// </summary>
|
||||
/// <param name="settingId">The known identification number of the setting to change its value.</param>
|
||||
/// <param name="settingType">The type of the setting value.</param>
|
||||
/// <param name="value">The new value for the setting.</param>
|
||||
public void SetSetting(KnownSettingId settingId, DRSSettingType settingType, object value)
|
||||
{
|
||||
SetSetting(SettingInfo.GetSettingId(settingId), settingType, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a new value for a setting or creates a new setting and sets its value
|
||||
/// </summary>
|
||||
/// <param name="settingId">The known identification number of the setting to change its value.</param>
|
||||
/// <param name="value">The new value for the setting.</param>
|
||||
public void SetSetting(KnownSettingId settingId, string value)
|
||||
{
|
||||
SetSetting(SettingInfo.GetSettingId(settingId), value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a new value for a setting or creates a new setting and sets its value
|
||||
/// </summary>
|
||||
/// <param name="settingId">The known identification number of the setting to change its value.</param>
|
||||
/// <param name="value">The new value for the setting.</param>
|
||||
public void SetSetting(KnownSettingId settingId, byte[] value)
|
||||
{
|
||||
SetSetting(SettingInfo.GetSettingId(settingId), value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a new value for a setting or creates a new setting and sets its value
|
||||
/// </summary>
|
||||
/// <param name="settingId">The known identification number of the setting to change its value.</param>
|
||||
/// <param name="value">The new value for the setting.</param>
|
||||
public void SetSetting(KnownSettingId settingId, uint value)
|
||||
{
|
||||
SetSetting(SettingInfo.GetSettingId(settingId), value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a new value for a setting or creates a new setting and sets its value
|
||||
/// </summary>
|
||||
/// <param name="settingId">The identification number of the setting to change its value.</param>
|
||||
/// <param name="settingType">The type of the setting value.</param>
|
||||
/// <param name="value">The new value for the setting.</param>
|
||||
public void SetSetting(uint settingId, DRSSettingType settingType, object value)
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid profile instance."
|
||||
);
|
||||
}
|
||||
|
||||
var setting = new DRSSettingV1(settingId, settingType, value);
|
||||
|
||||
DRSApi.SetSetting(Session.Handle, Handle, setting);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a new value for a setting or creates a new setting and sets its value
|
||||
/// </summary>
|
||||
/// <param name="settingId">The identification number of the setting to change its value.</param>
|
||||
/// <param name="value">The new value for the setting.</param>
|
||||
public void SetSetting(uint settingId, string value)
|
||||
{
|
||||
SetSetting(settingId, DRSSettingType.UnicodeString, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a new value for a setting or creates a new setting and sets its value
|
||||
/// </summary>
|
||||
/// <param name="settingId">The identification number of the setting to change its value.</param>
|
||||
/// <param name="value">The new value for the setting.</param>
|
||||
public void SetSetting(uint settingId, byte[] value)
|
||||
{
|
||||
SetSetting(settingId, DRSSettingType.Binary, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a new value for a setting or creates a new setting and sets its value
|
||||
/// </summary>
|
||||
/// <param name="settingId">The identification number of the setting to change its value.</param>
|
||||
/// <param name="value">The new value for the setting.</param>
|
||||
public void SetSetting(uint settingId, uint value)
|
||||
{
|
||||
SetSetting(settingId, DRSSettingType.Integer, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
236
app/NvAPIWrapper/DRS/DriverSettingsSession.cs
Normal file
236
app/NvAPIWrapper/DRS/DriverSettingsSession.cs
Normal file
@@ -0,0 +1,236 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NvAPIWrapper.Native;
|
||||
using NvAPIWrapper.Native.DRS.Structures;
|
||||
|
||||
namespace NvAPIWrapper.DRS
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a driver settings session. This is the starting point for using DRS set of functionalities.
|
||||
/// </summary>
|
||||
public class DriverSettingsSession : IDisposable
|
||||
{
|
||||
internal DriverSettingsSession(DRSSessionHandle handle)
|
||||
{
|
||||
Handle = handle;
|
||||
}
|
||||
|
||||
private DriverSettingsSession() : this(DRSApi.CreateSession())
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base settings profile
|
||||
/// </summary>
|
||||
public DriverSettingsProfile BaseProfile
|
||||
{
|
||||
get
|
||||
{
|
||||
var profileHandle = DRSApi.GetBaseProfile(Handle);
|
||||
|
||||
if (profileHandle.IsNull)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new DriverSettingsProfile(profileHandle, this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the global settings profile
|
||||
/// </summary>
|
||||
public DriverSettingsProfile CurrentGlobalProfile
|
||||
{
|
||||
get
|
||||
{
|
||||
var profileHandle = DRSApi.GetCurrentGlobalProfile(Handle);
|
||||
|
||||
if (profileHandle.IsNull)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new DriverSettingsProfile(profileHandle, this);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(value.Name))
|
||||
{
|
||||
throw new ArgumentException("Profile name can not be empty.", nameof(value));
|
||||
}
|
||||
|
||||
DRSApi.SetCurrentGlobalProfile(Handle, value.Name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the session handle
|
||||
/// </summary>
|
||||
public DRSSessionHandle Handle { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of registered profiles
|
||||
/// </summary>
|
||||
public int NumberOfProfiles
|
||||
{
|
||||
get => DRSApi.GetNumberOfProfiles(Handle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of all registered profiles
|
||||
/// </summary>
|
||||
public IEnumerable<DriverSettingsProfile> Profiles
|
||||
{
|
||||
get { return DRSApi.EnumProfiles(Handle).Select(handle => new DriverSettingsProfile(handle, this)); }
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
ReleaseUnmanagedResources();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new session and load the settings
|
||||
/// </summary>
|
||||
/// <returns>A new instance of <see cref="DriverSettingsSession" /> representing a session.</returns>
|
||||
public static DriverSettingsSession CreateAndLoad()
|
||||
{
|
||||
var session = new DriverSettingsSession();
|
||||
session.Load();
|
||||
|
||||
return session;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new session and load the settings from a file
|
||||
/// </summary>
|
||||
/// <param name="fileName">The full path of file to load settings from.</param>
|
||||
/// <returns>A new instance of <see cref="DriverSettingsSession" /> representing a session.</returns>
|
||||
public static DriverSettingsSession CreateAndLoad(string fileName)
|
||||
{
|
||||
var session = new DriverSettingsSession();
|
||||
session.Load(fileName);
|
||||
|
||||
return session;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Handle} ({NumberOfProfiles} Profiles)";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds an application by name. This method is useful when passed a full path of a file as it does return an
|
||||
/// application almost always describing the NVIDIA driver behavior regarding the passed executable file.
|
||||
/// </summary>
|
||||
/// <param name="applicationName">The name of the application (with extension) or the full path of an executable file.</param>
|
||||
/// <returns>An instance of <see cref="ProfileApplication" /> class.</returns>
|
||||
public ProfileApplication FindApplication(string applicationName)
|
||||
{
|
||||
var application = DRSApi.FindApplicationByName(Handle, applicationName, out var profileHandle);
|
||||
|
||||
if (application == null || !profileHandle.HasValue || profileHandle.Value.IsNull)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var profile = new DriverSettingsProfile(profileHandle.Value, this);
|
||||
|
||||
return new ProfileApplication(application, profile);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds a profile based on the application named passed. This method is useful when passed a full path of a file as
|
||||
/// it does return a profile almost always describing the NVIDIA driver behavior regarding the passed executable file.
|
||||
/// </summary>
|
||||
/// <param name="applicationName">The name of the application (with extension) or the full path of an executable file.</param>
|
||||
/// <returns>
|
||||
/// An instance of <see cref="DriverSettingsProfile" /> class describing the NVIDIA driver behavior regarding the
|
||||
/// passed executable file.
|
||||
/// </returns>
|
||||
public DriverSettingsProfile FindApplicationProfile(string applicationName)
|
||||
{
|
||||
var application = DRSApi.FindApplicationByName(Handle, applicationName, out var profileHandle);
|
||||
|
||||
if (application == null || !profileHandle.HasValue || profileHandle.Value.IsNull)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new DriverSettingsProfile(profileHandle.Value, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds a profile based on its name.
|
||||
/// </summary>
|
||||
/// <param name="profileName">The profile name to search for.</param>
|
||||
/// <returns>An instance of <see cref="DriverSettingsProfile" /> class.</returns>
|
||||
public DriverSettingsProfile FindProfileByName(string profileName)
|
||||
{
|
||||
var profileHandle = DRSApi.FindProfileByName(Handle, profileName);
|
||||
|
||||
if (profileHandle.IsNull)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new DriverSettingsProfile(profileHandle, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets all settings to default.
|
||||
/// </summary>
|
||||
public void RestoreDefaults()
|
||||
{
|
||||
DRSApi.RestoreDefaults(Handle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the current session settings
|
||||
/// </summary>
|
||||
public void Save()
|
||||
{
|
||||
DRSApi.SaveSettings(Handle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the current session settings to a file
|
||||
/// </summary>
|
||||
/// <param name="fileName">The full path of file to save settings to.</param>
|
||||
public void Save(string fileName)
|
||||
{
|
||||
DRSApi.SaveSettings(Handle, fileName);
|
||||
}
|
||||
|
||||
private void Load()
|
||||
{
|
||||
DRSApi.LoadSettings(Handle);
|
||||
}
|
||||
|
||||
private void Load(string fileName)
|
||||
{
|
||||
DRSApi.LoadSettings(Handle, fileName);
|
||||
}
|
||||
|
||||
private void ReleaseUnmanagedResources()
|
||||
{
|
||||
DRSApi.DestroySession(Handle);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
~DriverSettingsSession()
|
||||
{
|
||||
ReleaseUnmanagedResources();
|
||||
}
|
||||
}
|
||||
}
|
||||
555
app/NvAPIWrapper/DRS/KnownSettingId.cs
Normal file
555
app/NvAPIWrapper/DRS/KnownSettingId.cs
Normal file
@@ -0,0 +1,555 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace NvAPIWrapper.DRS
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum KnownSettingId : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// Antialiasing - Line gamma
|
||||
/// </summary>
|
||||
[Description("Antialiasing - Line gamma")]
|
||||
OpenGLAntiAliasingLineGamma = 0x2089BF6C,
|
||||
|
||||
/// <summary>
|
||||
/// Deep color for 3D applications
|
||||
/// </summary>
|
||||
[Description("Deep color for 3D applications")]
|
||||
OpenGLDeepColorScanOut = 0x2097C2F6,
|
||||
|
||||
/// <summary>
|
||||
/// OpenGL default swap interval
|
||||
/// </summary>
|
||||
[Description("OpenGL default swap interval")]
|
||||
OpenGLDefaultSwapInterval = 0x206A6582,
|
||||
|
||||
/// <summary>
|
||||
/// OpenGL default swap interval fraction
|
||||
/// </summary>
|
||||
[Description("OpenGL default swap interval fraction")]
|
||||
OpenGLDefaultSwapIntervalFractional = 0x206C4581,
|
||||
|
||||
/// <summary>
|
||||
/// OpenGL default swap interval sign
|
||||
/// </summary>
|
||||
[Description("OpenGL default swap interval sign")]
|
||||
OpenGLDefaultSwapIntervalSign = 0x20655CFA,
|
||||
|
||||
/// <summary>
|
||||
/// Event Log Severity Threshold
|
||||
/// </summary>
|
||||
[Description("Event Log Severity Threshold")]
|
||||
OpenGLEventLogSeverityThreshold = 0x209DF23E,
|
||||
|
||||
/// <summary>
|
||||
/// Extension String version
|
||||
/// </summary>
|
||||
[Description("Extension String version")]
|
||||
OpenGLExtensionStringVersion = 0x20FF7493,
|
||||
|
||||
/// <summary>
|
||||
/// Buffer-flipping mode
|
||||
/// </summary>
|
||||
[Description("Buffer-flipping mode")] OpenGLForceBlit = 0x201F619F,
|
||||
|
||||
/// <summary>
|
||||
/// Force Stereo shuttering
|
||||
/// </summary>
|
||||
[Description("Force Stereo shuttering")]
|
||||
OpenGLForceStereo = 0x204D9A0C,
|
||||
|
||||
/// <summary>
|
||||
/// Preferred OpenGL GPU
|
||||
/// </summary>
|
||||
[Description("Preferred OpenGL GPU")] OpenGLImplicitGPUAffinity = 0x20D0F3E6,
|
||||
|
||||
/// <summary>
|
||||
/// Maximum frames allowed
|
||||
/// </summary>
|
||||
[Description("Maximum frames allowed")]
|
||||
OpenGLMaximumFramesAllowed = 0x208E55E3,
|
||||
|
||||
/// <summary>
|
||||
/// Exported Overlay pixel types
|
||||
/// </summary>
|
||||
[Description("Exported Overlay pixel types")]
|
||||
OpenGLOverlayPixelType = 0x209AE66F,
|
||||
|
||||
/// <summary>
|
||||
/// Enable overlay
|
||||
/// </summary>
|
||||
[Description("Enable overlay")] OpenGLOverlaySupport = 0x206C28C4,
|
||||
|
||||
/// <summary>
|
||||
/// High level control of the rendering quality on OpenGL
|
||||
/// </summary>
|
||||
[Description("High level control of the rendering quality on OpenGL")]
|
||||
OpenGLQualityEnhancements = 0x20797D6C,
|
||||
|
||||
/// <summary>
|
||||
/// Unified back/depth buffer
|
||||
/// </summary>
|
||||
[Description("Unified back/depth buffer")]
|
||||
OpenGLSingleBackDepthBuffer = 0x20A29055,
|
||||
|
||||
/// <summary>
|
||||
/// Enable NV_gpu_multicast extension
|
||||
/// </summary>
|
||||
[Description("Enable NV_gpu_multicast extension")]
|
||||
OpenGLSLIMulticast = 0x2092D3BE,
|
||||
|
||||
/// <summary>
|
||||
/// Threaded optimization
|
||||
/// </summary>
|
||||
[Description("Threaded optimization")] OpenGLThreadControl = 0x20C1221E,
|
||||
|
||||
/// <summary>
|
||||
/// Event Log Tmon Severity Threshold
|
||||
/// </summary>
|
||||
[Description("Event Log Tmon Severity Threshold")]
|
||||
OpenGLTMONLevel = 0x202888C1,
|
||||
|
||||
/// <summary>
|
||||
/// Triple buffering
|
||||
/// </summary>
|
||||
[Description("Triple buffering")] OpenGLTripleBuffer = 0x20FDD1F9,
|
||||
|
||||
/// <summary>
|
||||
/// Antialiasing - Behavior Flags
|
||||
/// </summary>
|
||||
[Description("Antialiasing - Behavior Flags")]
|
||||
AntiAliasingBehaviorFlags = 0x10ECDB82,
|
||||
|
||||
/// <summary>
|
||||
/// Antialiasing - Transparency Multisampling
|
||||
/// </summary>
|
||||
[Description("Antialiasing - Transparency Multisampling")]
|
||||
AntiAliasingModeAlphaToCoverage = 0x10FC2D9C,
|
||||
|
||||
/// <summary>
|
||||
/// Antialiasing - Gamma correction
|
||||
/// </summary>
|
||||
[Description("Antialiasing - Gamma correction")]
|
||||
AntiAliasingModeGammaCorrection = 0x107D639D,
|
||||
|
||||
/// <summary>
|
||||
/// Antialiasing - Setting
|
||||
/// </summary>
|
||||
[Description("Antialiasing - Setting")]
|
||||
AntiAliasingModeMethod = 0x10D773D2,
|
||||
|
||||
/// <summary>
|
||||
/// Antialiasing - Transparency Supersampling
|
||||
/// </summary>
|
||||
[Description("Antialiasing - Transparency Supersampling")]
|
||||
AntiAliasingModeReplay = 0x10D48A85,
|
||||
|
||||
/// <summary>
|
||||
/// Antialiasing - Mode
|
||||
/// </summary>
|
||||
[Description("Antialiasing - Mode")] AntiAliasingModeSelector = 0x107EFC5B,
|
||||
|
||||
/// <summary>
|
||||
/// Antialiasing - SLI AA
|
||||
/// </summary>
|
||||
[Description("Antialiasing - SLI AA")] AntiAliasingModeSelectorSLIAntiAliasing = 0x107AFC5B,
|
||||
|
||||
/// <summary>
|
||||
/// Anisotropic filtering setting
|
||||
/// </summary>
|
||||
[Description("Anisotropic filtering setting")]
|
||||
AnisotropicModeLevel = 0x101E61A9,
|
||||
|
||||
/// <summary>
|
||||
/// Anisotropic filtering mode
|
||||
/// </summary>
|
||||
[Description("Anisotropic filtering mode")]
|
||||
AnisotropicModeSelector = 0x10D2BB16,
|
||||
|
||||
/// <summary>
|
||||
/// NVIDIA Predefined Ansel Usage
|
||||
/// </summary>
|
||||
[Description("NVIDIA Predefined Ansel Usage")]
|
||||
AnselAllow = 0x1035DB89,
|
||||
|
||||
/// <summary>
|
||||
/// Enable Ansel
|
||||
/// </summary>
|
||||
[Description("Enable Ansel")] AnselEnable = 0x1075D972,
|
||||
|
||||
/// <summary>
|
||||
/// Ansel flags for enabled applications
|
||||
/// </summary>
|
||||
[Description("Ansel flags for enabled applications")]
|
||||
AnselWhiteListed = 0x1085DA8A,
|
||||
|
||||
/// <summary>
|
||||
/// Application Profile Notification Popup Timeout
|
||||
/// </summary>
|
||||
[Description("Application Profile Notification Popup Timeout")]
|
||||
ApplicationProfileNotificationTimeOut = 0x104554B6,
|
||||
|
||||
/// <summary>
|
||||
/// Steam Application ID
|
||||
/// </summary>
|
||||
[Description("Steam Application ID")] ApplicationSteamId = 0x107CDDBC,
|
||||
|
||||
/// <summary>
|
||||
/// Battery Boost
|
||||
/// </summary>
|
||||
[Description("Battery Boost")] BatteryBoost = 0x10115C89,
|
||||
|
||||
/// <summary>
|
||||
/// Do not display this profile in the Control Panel
|
||||
/// </summary>
|
||||
[Description("Do not display this profile in the Control Panel")]
|
||||
ControlPanelHiddenProfile = 0x106D5CFF,
|
||||
|
||||
/// <summary>
|
||||
/// List of Universal GPU ids
|
||||
/// </summary>
|
||||
[Description("List of Universal GPU ids")]
|
||||
CUDAExcludedGPUs = 0x10354FF8,
|
||||
|
||||
/// <summary>
|
||||
/// Maximum GPU Power
|
||||
/// </summary>
|
||||
[Description("Maximum GPU Power")] D3DOpenGLGPUMaximumPower = 0x10D1EF29,
|
||||
|
||||
/// <summary>
|
||||
/// Export Performance Counters
|
||||
/// </summary>
|
||||
[Description("Export Performance Counters")]
|
||||
ExportPerformanceCounters = 0x108F0841,
|
||||
|
||||
/// <summary>
|
||||
/// NVIDIA Predefined FXAA Usage
|
||||
/// </summary>
|
||||
[Description("NVIDIA Predefined FXAA Usage")]
|
||||
FXAAAllow = 0x1034CB89,
|
||||
|
||||
/// <summary>
|
||||
/// Enable FXAA
|
||||
/// </summary>
|
||||
[Description("Enable FXAA")] FXAAEnable = 0x1074C972,
|
||||
|
||||
/// <summary>
|
||||
/// Enable FXAA Indicator
|
||||
/// </summary>
|
||||
[Description("Enable FXAA Indicator")] FXAAIndicatorEnable = 0x1068FB9C,
|
||||
|
||||
/// <summary>
|
||||
/// SLI indicator
|
||||
/// </summary>
|
||||
[Description("SLI indicator")] MCSFRShowSplit = 0x10287051,
|
||||
|
||||
/// <summary>
|
||||
/// NVIDIA Quality upscaling
|
||||
/// </summary>
|
||||
[Description("NVIDIA Quality upscaling")]
|
||||
NvidiaQualityUpScaling = 0x10444444,
|
||||
|
||||
/// <summary>
|
||||
/// Maximum AA samples allowed for a given application
|
||||
/// </summary>
|
||||
[Description("Maximum AA samples allowed for a given application")]
|
||||
OptimusMaximumAntiAliasing = 0x10F9DC83,
|
||||
|
||||
/// <summary>
|
||||
/// Display the PhysX indicator
|
||||
/// </summary>
|
||||
[Description("Display the PhysX indicator")]
|
||||
PhysxIndicator = 0x1094F16F,
|
||||
|
||||
/// <summary>
|
||||
/// Power management mode
|
||||
/// </summary>
|
||||
[Description("Power management mode")] PreferredPerformanceState = 0x1057EB71,
|
||||
|
||||
/// <summary>
|
||||
/// No override of Anisotropic filtering
|
||||
/// </summary>
|
||||
[Description("No override of Anisotropic filtering")]
|
||||
PreventUiAnisotropicOverride = 0x103BCCB5,
|
||||
|
||||
/// <summary>
|
||||
/// Frame Rate Limiter
|
||||
/// </summary>
|
||||
[Description("Frame Rate Limiter")] PerformanceStateFrameRateLimiter = 0x10834FEE,
|
||||
|
||||
/// <summary>
|
||||
/// Frame Rate Limiter 2 Control
|
||||
/// </summary>
|
||||
[Description("Frame Rate Limiter 2 Control")]
|
||||
PerformanceStateFrameRateLimiter2Control = 0x10834FFF,
|
||||
|
||||
/// <summary>
|
||||
/// Frame Rate Monitor
|
||||
/// </summary>
|
||||
[Description("Frame Rate Monitor")] PerformanceStateFrameRateLimiterGpsControl = 0x10834F01,
|
||||
|
||||
/// <summary>
|
||||
/// Frame Rate Monitor Control
|
||||
/// </summary>
|
||||
[Description("Frame Rate Monitor Control")]
|
||||
PerformanceStateFrameRateMonitorControl = 0x10834F05,
|
||||
|
||||
/// <summary>
|
||||
/// Maximum resolution allowed for a given application
|
||||
/// </summary>
|
||||
[Description("Maximum resolution allowed for a given application")]
|
||||
ShimMaxResolution = 0x10F9DC82,
|
||||
|
||||
/// <summary>
|
||||
/// Optimus flags for enabled applications
|
||||
/// </summary>
|
||||
[Description("Optimus flags for enabled applications")]
|
||||
ShimMCCOMPAT = 0x10F9DC80,
|
||||
|
||||
/// <summary>
|
||||
/// Enable application for Optimus
|
||||
/// </summary>
|
||||
[Description("Enable application for Optimus")]
|
||||
ShimRenderingMode = 0x10F9DC81,
|
||||
|
||||
/// <summary>
|
||||
/// Shim Rendering Mode Options per application for Optimus
|
||||
/// </summary>
|
||||
[Description("Shim Rendering Mode Options per application for Optimus")]
|
||||
ShimRenderingOptions = 0x10F9DC84,
|
||||
|
||||
/// <summary>
|
||||
/// Number of GPUs to use on SLI rendering mode
|
||||
/// </summary>
|
||||
[Description("Number of GPUs to use on SLI rendering mode")]
|
||||
SLIGPUCount = 0x1033DCD1,
|
||||
|
||||
/// <summary>
|
||||
/// NVIDIA predefined number of GPUs to use on SLI rendering mode
|
||||
/// </summary>
|
||||
[Description("NVIDIA predefined number of GPUs to use on SLI rendering mode")]
|
||||
SLIPredefinedGPUCount = 0x1033DCD2,
|
||||
|
||||
/// <summary>
|
||||
/// NVIDIA predefined number of GPUs to use on SLI rendering mode on DirectX 10
|
||||
/// </summary>
|
||||
[Description("NVIDIA predefined number of GPUs to use on SLI rendering mode on DirectX 10")]
|
||||
SLIPredefinedGPUCountDX10 = 0x1033DCD3,
|
||||
|
||||
/// <summary>
|
||||
/// NVIDIA predefined SLI mode
|
||||
/// </summary>
|
||||
[Description("NVIDIA predefined SLI mode")]
|
||||
SLIPredefinedMode = 0x1033CEC1,
|
||||
|
||||
/// <summary>
|
||||
/// NVIDIA predefined SLI mode on DirectX 10
|
||||
/// </summary>
|
||||
[Description("NVIDIA predefined SLI mode on DirectX 10")]
|
||||
SLIPredefinedModeDX10 = 0x1033CEC2,
|
||||
|
||||
/// <summary>
|
||||
/// SLI rendering mode
|
||||
/// </summary>
|
||||
[Description("SLI rendering mode")] SLIRenderingMode = 0x1033CED1,
|
||||
|
||||
/// <summary>
|
||||
/// Virtual Reality pre-rendered frames
|
||||
/// </summary>
|
||||
[Description("Virtual Reality pre-rendered frames")]
|
||||
VRPreRenderLimit = 0x10111133,
|
||||
|
||||
/// <summary>
|
||||
/// Toggle the VRR global feature
|
||||
/// </summary>
|
||||
[Description("Toggle the VRR global feature")]
|
||||
VRRFeatureIndicator = 0x1094F157,
|
||||
|
||||
/// <summary>
|
||||
/// Display the VRR Overlay Indicator
|
||||
/// </summary>
|
||||
[Description("Display the VRR Overlay Indicator")]
|
||||
VRROverlayIndicator = 0x1095F16F,
|
||||
|
||||
/// <summary>
|
||||
/// VRR requested state
|
||||
/// </summary>
|
||||
[Description("VRR requested state")] VRRRequestState = 0x1094F1F7,
|
||||
|
||||
/// <summary>
|
||||
/// G-SYNC
|
||||
/// </summary>
|
||||
[Description("G-SYNC")] VRRApplicationOverride = 0x10A879CF,
|
||||
|
||||
/// <summary>
|
||||
/// G-SYNC
|
||||
/// </summary>
|
||||
[Description("G-SYNC")] VRRApplicationOverrideRequestState = 0x10A879AC,
|
||||
|
||||
/// <summary>
|
||||
/// Enable G-SYNC globally
|
||||
/// </summary>
|
||||
[Description("Enable G-SYNC globally")]
|
||||
VRRMode = 0x1194F158,
|
||||
|
||||
/// <summary>
|
||||
/// Flag to control smooth AFR behavior
|
||||
/// </summary>
|
||||
[Description("Flag to control smooth AFR behavior")]
|
||||
VSyncSmoothAFR = 0x101AE763,
|
||||
|
||||
/// <summary>
|
||||
/// Variable refresh Rate
|
||||
/// </summary>
|
||||
[Description("Variable refresh Rate")] VSyncVRRControl = 0x10A879CE,
|
||||
|
||||
/// <summary>
|
||||
/// Vsync - Behavior Flags
|
||||
/// </summary>
|
||||
[Description("Vsync - Behavior Flags")]
|
||||
VSyncBehaviorFlags = 0x10FDEC23,
|
||||
|
||||
/// <summary>
|
||||
/// Stereo - Swap eyes
|
||||
/// </summary>
|
||||
[Description("Stereo - Swap eyes")] WKSAPIStereoEyesExchange = 0x11AE435C,
|
||||
|
||||
/// <summary>
|
||||
/// Stereo - Display mode
|
||||
/// </summary>
|
||||
[Description("Stereo - Display mode")] WKSAPIStereoMode = 0x11E91A61,
|
||||
|
||||
/// <summary>
|
||||
/// Memory Allocation Policy
|
||||
/// </summary>
|
||||
[Description("Memory Allocation Policy")]
|
||||
WKSMemoryAllocationPolicy = 0x11112233,
|
||||
|
||||
/// <summary>
|
||||
/// Stereo - Dongle Support
|
||||
/// </summary>
|
||||
[Description("Stereo - Dongle Support")]
|
||||
WKSStereoDongleSupport = 0x112493BD,
|
||||
|
||||
/// <summary>
|
||||
/// Stereo - Enable
|
||||
/// </summary>
|
||||
[Description("Stereo - Enable")] WKSStereoSupport = 0x11AA9E99,
|
||||
|
||||
/// <summary>
|
||||
/// Stereo <20> swap mode
|
||||
/// </summary>
|
||||
[Description("Stereo <20> swap mode")] WKSStereoSwapMode = 0x11333333,
|
||||
|
||||
/// <summary>
|
||||
/// Ambient Occlusion
|
||||
/// </summary>
|
||||
[Description("Ambient Occlusion")] AmbientOcclusionMode = 0x667329,
|
||||
|
||||
/// <summary>
|
||||
/// NVIDIA Predefined Ambient Occlusion Usage
|
||||
/// </summary>
|
||||
[Description("NVIDIA Predefined Ambient Occlusion Usage")]
|
||||
AmbientOcclusionModeActive = 0x664339,
|
||||
|
||||
/// <summary>
|
||||
/// Texture filtering - Driver Controlled LOD Bias
|
||||
/// </summary>
|
||||
[Description("Texture filtering - Driver Controlled LOD Bias")]
|
||||
AutoLODBiasAdjust = 0x638E8F,
|
||||
|
||||
/// <summary>
|
||||
/// Export Performance Counters for DX9 only
|
||||
/// </summary>
|
||||
[Description("Export Performance Counters for DX9 only")]
|
||||
ExportPerformanceCountersDX9Only = 0xB65E72,
|
||||
|
||||
/// <summary>
|
||||
/// ICafe Settings
|
||||
/// </summary>
|
||||
[Description("ICafe Settings")] ICafeLogoConfig = 0xDB1337,
|
||||
|
||||
/// <summary>
|
||||
/// Texture filtering - LOD Bias
|
||||
/// </summary>
|
||||
[Description("Texture filtering - LOD Bias")]
|
||||
LODBiasAdjust = 0x738E8F,
|
||||
|
||||
/// <summary>
|
||||
/// Enable sample interleaving (MFAA)
|
||||
/// </summary>
|
||||
[Description("Enable sample interleaving (MFAA)")]
|
||||
MaxwellBSampleInterleave = 0x98C1AC,
|
||||
|
||||
/// <summary>
|
||||
/// Maximum pre-rendered frames
|
||||
/// </summary>
|
||||
[Description("Maximum pre-rendered frames")]
|
||||
PreRenderLimit = 0x7BA09E,
|
||||
|
||||
/// <summary>
|
||||
/// Shader Cache
|
||||
/// </summary>
|
||||
[Description("Shader Cache")] PerformanceStateShaderDiskCache = 0x198FFF,
|
||||
|
||||
/// <summary>
|
||||
/// Texture filtering - Anisotropic sample optimization
|
||||
/// </summary>
|
||||
[Description("Texture filtering - Anisotropic sample optimization")]
|
||||
PerformanceStateTextureFilteringAnisotropicOptimization = 0xE73211,
|
||||
|
||||
/// <summary>
|
||||
/// Texture filtering - Anisotropic filter optimization
|
||||
/// </summary>
|
||||
[Description("Texture filtering - Anisotropic filter optimization")]
|
||||
PerformanceStateTextureFilteringBiLinearInAnisotropic = 0x84CD70,
|
||||
|
||||
/// <summary>
|
||||
/// Texture filtering - Trilinear optimization
|
||||
/// </summary>
|
||||
[Description("Texture filtering - Trilinear optimization")]
|
||||
PerformanceStateTextureFilteringDisableTrilinearSlope = 0x2ECAF2,
|
||||
|
||||
/// <summary>
|
||||
/// Texture filtering - Negative LOD bias
|
||||
/// </summary>
|
||||
[Description("Texture filtering - Negative LOD bias")]
|
||||
PerformanceStateTextureFilteringNoNegativeLODBias = 0x19BB68,
|
||||
|
||||
/// <summary>
|
||||
/// Texture filtering - Quality
|
||||
/// </summary>
|
||||
[Description("Texture filtering - Quality")]
|
||||
QualityEnhancements = 0xCE2691,
|
||||
|
||||
/// <summary>
|
||||
/// Preferred refresh rate
|
||||
/// </summary>
|
||||
[Description("Preferred refresh rate")]
|
||||
RefreshRateOverride = 0x64B541,
|
||||
|
||||
/// <summary>
|
||||
/// PowerThrottle
|
||||
/// </summary>
|
||||
[Description("PowerThrottle")] SetPowerThrottleForPCIeCompliance = 0xAE785C,
|
||||
|
||||
/// <summary>
|
||||
/// VAB Default Data
|
||||
/// </summary>
|
||||
[Description("VAB Default Data")] SetVABData = 0xAB8687,
|
||||
|
||||
/// <summary>
|
||||
/// Vertical Sync
|
||||
/// </summary>
|
||||
[Description("Vertical Sync")] VSyncMode = 0xA879CF,
|
||||
|
||||
/// <summary>
|
||||
/// Vertical Sync Tear Control
|
||||
/// </summary>
|
||||
[Description("Vertical Sync Tear Control")]
|
||||
VSyncTearControl = 0x5A375C,
|
||||
|
||||
InvalidSetting = 0xFFFFFFFF
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
424
app/NvAPIWrapper/DRS/ProfileApplication.cs
Normal file
424
app/NvAPIWrapper/DRS/ProfileApplication.cs
Normal file
@@ -0,0 +1,424 @@
|
||||
using System;
|
||||
using NvAPIWrapper.Native;
|
||||
using NvAPIWrapper.Native.DRS.Structures;
|
||||
using NvAPIWrapper.Native.Exceptions;
|
||||
using NvAPIWrapper.Native.Interfaces.DRS;
|
||||
|
||||
namespace NvAPIWrapper.DRS
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an application rule registered in a profile
|
||||
/// </summary>
|
||||
public class ProfileApplication
|
||||
{
|
||||
private IDRSApplication _application;
|
||||
|
||||
internal ProfileApplication(IDRSApplication application, DriverSettingsProfile profile)
|
||||
{
|
||||
Profile = profile;
|
||||
_application = application;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the application name
|
||||
/// </summary>
|
||||
public string ApplicationName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid application instance."
|
||||
);
|
||||
}
|
||||
|
||||
return _application.ApplicationName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the application command line
|
||||
/// </summary>
|
||||
public string CommandLine
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid application instance."
|
||||
);
|
||||
}
|
||||
|
||||
if (_application is DRSApplicationV4 applicationV4)
|
||||
{
|
||||
return applicationV4.ApplicationCommandLine;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of files that are necessary to be present inside the application parent directory
|
||||
/// </summary>
|
||||
public string[] FilesInFolder
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid application instance."
|
||||
);
|
||||
}
|
||||
|
||||
if (_application is DRSApplicationV2 applicationV2)
|
||||
{
|
||||
return applicationV2.FilesInFolder;
|
||||
}
|
||||
|
||||
if (_application is DRSApplicationV3 applicationV3)
|
||||
{
|
||||
return applicationV3.FilesInFolder;
|
||||
}
|
||||
|
||||
if (_application is DRSApplicationV4 applicationV4)
|
||||
{
|
||||
return applicationV4.FilesInFolder;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the application friendly name
|
||||
/// </summary>
|
||||
public string FriendlyName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid application instance."
|
||||
);
|
||||
}
|
||||
|
||||
return _application.FriendlyName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean value indicating if this application rule needs a specific command line; or <see langword="null" />
|
||||
/// if this information is not available.
|
||||
/// </summary>
|
||||
public bool? HasCommandLine
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid application instance."
|
||||
);
|
||||
}
|
||||
|
||||
if (_application is DRSApplicationV3 applicationV3)
|
||||
{
|
||||
return applicationV3.HasCommandLine;
|
||||
}
|
||||
|
||||
if (_application is DRSApplicationV4 applicationV4)
|
||||
{
|
||||
return applicationV4.HasCommandLine;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean value indicating if this application is a metro application; or <see langword="null" /> if this
|
||||
/// information is not available.
|
||||
/// </summary>
|
||||
public bool? IsMetroApplication
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid application instance."
|
||||
);
|
||||
}
|
||||
|
||||
if (_application is DRSApplicationV3 applicationV3)
|
||||
{
|
||||
return applicationV3.IsMetroApplication;
|
||||
}
|
||||
|
||||
if (_application is DRSApplicationV4 applicationV4)
|
||||
{
|
||||
return applicationV4.IsMetroApplication;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean value indicating if this application is predefined by the NVIDIA driver
|
||||
/// </summary>
|
||||
public bool IsPredefined
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid application instance."
|
||||
);
|
||||
}
|
||||
|
||||
return _application.IsPredefined;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean value indicating if this instance of <see cref="ProfileApplication" /> is a valid instance
|
||||
/// representing an application in a profile
|
||||
/// </summary>
|
||||
public bool IsValid
|
||||
{
|
||||
get => _application != null && Profile.IsValid;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the application launcher name
|
||||
/// </summary>
|
||||
public string LauncherName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid application instance."
|
||||
);
|
||||
}
|
||||
|
||||
return _application.LauncherName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the parent profile instance
|
||||
/// </summary>
|
||||
public DriverSettingsProfile Profile { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new application
|
||||
/// </summary>
|
||||
/// <param name="profile">The profile to create the new application in.</param>
|
||||
/// <param name="applicationName">The application name (with extension).</param>
|
||||
/// <param name="friendlyName">The application friendly name.</param>
|
||||
/// <param name="launcherName">The application launcher name.</param>
|
||||
/// <param name="fileInFolders">An array of files necessary to be present inside the application parent directory.</param>
|
||||
/// <param name="isMetro">A boolean value indicating if this application is a metro application.</param>
|
||||
/// <param name="commandLine">The application command line string.</param>
|
||||
/// <returns>A new instance of <see cref="ProfileApplication" /> representing the newly created application.</returns>
|
||||
// ReSharper disable once TooManyArguments
|
||||
// ReSharper disable once FunctionComplexityOverflow
|
||||
public static ProfileApplication CreateApplication(
|
||||
DriverSettingsProfile profile,
|
||||
string applicationName,
|
||||
string friendlyName = null,
|
||||
string launcherName = null,
|
||||
string[] fileInFolders = null,
|
||||
bool isMetro = false,
|
||||
string commandLine = null
|
||||
)
|
||||
{
|
||||
var createDelegates = new Func<string, string, string, string[], bool, string, IDRSApplication>[]
|
||||
{
|
||||
CreateApplicationInstanceV4,
|
||||
CreateApplicationInstanceV3,
|
||||
CreateApplicationInstanceV2,
|
||||
CreateApplicationInstanceV1
|
||||
};
|
||||
|
||||
Exception lastException = null;
|
||||
IDRSApplication application = null;
|
||||
|
||||
foreach (var func in createDelegates)
|
||||
{
|
||||
try
|
||||
{
|
||||
// ReSharper disable once EventExceptionNotDocumented
|
||||
application = func(
|
||||
applicationName,
|
||||
friendlyName,
|
||||
launcherName,
|
||||
fileInFolders,
|
||||
isMetro,
|
||||
commandLine
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
catch (NVIDIANotSupportedException e)
|
||||
{
|
||||
// ignore
|
||||
lastException = e;
|
||||
}
|
||||
}
|
||||
|
||||
if (application == null)
|
||||
{
|
||||
// ReSharper disable once ThrowingSystemException
|
||||
throw lastException;
|
||||
}
|
||||
|
||||
application = DRSApi.CreateApplication(profile.Session.Handle, profile.Handle, application);
|
||||
|
||||
return new ProfileApplication(application, profile);
|
||||
}
|
||||
|
||||
// ReSharper disable once TooManyArguments
|
||||
private static IDRSApplication CreateApplicationInstanceV1(
|
||||
string applicationName,
|
||||
string friendlyName = null,
|
||||
string launcherName = null,
|
||||
string[] fileInFolders = null,
|
||||
bool isMetro = false,
|
||||
string commandLine = null
|
||||
)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(commandLine))
|
||||
{
|
||||
throw new NotSupportedException(
|
||||
"CommandLine is not supported with the current execution environment."
|
||||
);
|
||||
}
|
||||
|
||||
if (fileInFolders?.Length > 0)
|
||||
{
|
||||
throw new NotSupportedException(
|
||||
"Same folder file presence check is not supported with the current execution environment."
|
||||
);
|
||||
}
|
||||
|
||||
return new DRSApplicationV1(
|
||||
applicationName,
|
||||
friendlyName,
|
||||
launcherName
|
||||
);
|
||||
}
|
||||
|
||||
// ReSharper disable once TooManyArguments
|
||||
private static IDRSApplication CreateApplicationInstanceV2(
|
||||
string applicationName,
|
||||
string friendlyName = null,
|
||||
string launcherName = null,
|
||||
string[] fileInFolders = null,
|
||||
bool isMetro = false,
|
||||
string commandLine = null
|
||||
)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(commandLine))
|
||||
{
|
||||
throw new NotSupportedException(
|
||||
"CommandLine is not supported with the current execution environment."
|
||||
);
|
||||
}
|
||||
|
||||
return new DRSApplicationV2(
|
||||
applicationName,
|
||||
friendlyName,
|
||||
launcherName,
|
||||
fileInFolders
|
||||
);
|
||||
}
|
||||
|
||||
// ReSharper disable once TooManyArguments
|
||||
private static IDRSApplication CreateApplicationInstanceV3(
|
||||
string applicationName,
|
||||
string friendlyName = null,
|
||||
string launcherName = null,
|
||||
string[] fileInFolders = null,
|
||||
bool isMetro = false,
|
||||
string commandLine = null
|
||||
)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(commandLine))
|
||||
{
|
||||
throw new NotSupportedException(
|
||||
"CommandLine is not supported with the current execution environment."
|
||||
);
|
||||
}
|
||||
|
||||
return new DRSApplicationV3(
|
||||
applicationName,
|
||||
friendlyName,
|
||||
launcherName,
|
||||
fileInFolders,
|
||||
isMetro
|
||||
);
|
||||
}
|
||||
|
||||
// ReSharper disable once TooManyArguments
|
||||
private static IDRSApplication CreateApplicationInstanceV4(
|
||||
string applicationName,
|
||||
string friendlyName = null,
|
||||
string launcherName = null,
|
||||
string[] fileInFolders = null,
|
||||
bool isMetro = false,
|
||||
string commandLine = null
|
||||
)
|
||||
{
|
||||
return new DRSApplicationV4(
|
||||
applicationName,
|
||||
friendlyName,
|
||||
launcherName,
|
||||
fileInFolders,
|
||||
isMetro,
|
||||
commandLine
|
||||
);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
return "[Invalid]";
|
||||
}
|
||||
|
||||
if (IsPredefined)
|
||||
{
|
||||
return $"{ApplicationName} (Predefined)";
|
||||
}
|
||||
|
||||
return ApplicationName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes this application and makes this instance invalid
|
||||
/// </summary>
|
||||
public void Delete()
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Can not perform this operation with an invalid application instance."
|
||||
);
|
||||
}
|
||||
|
||||
DRSApi.DeleteApplication(Profile.Session.Handle, Profile.Handle, _application);
|
||||
_application = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
126
app/NvAPIWrapper/DRS/ProfileSetting.cs
Normal file
126
app/NvAPIWrapper/DRS/ProfileSetting.cs
Normal file
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using NvAPIWrapper.Native.DRS;
|
||||
using NvAPIWrapper.Native.DRS.Structures;
|
||||
|
||||
namespace NvAPIWrapper.DRS
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a profile setting and its value
|
||||
/// </summary>
|
||||
public class ProfileSetting
|
||||
{
|
||||
private readonly DRSSettingV1 _setting;
|
||||
|
||||
internal ProfileSetting(DRSSettingV1 setting)
|
||||
{
|
||||
_setting = setting;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current value of the setting
|
||||
/// </summary>
|
||||
public object CurrentValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsPredefinedValueValid && IsCurrentValuePredefined)
|
||||
{
|
||||
return _setting.PredefinedValue;
|
||||
}
|
||||
|
||||
return _setting.CurrentValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean value indicating if the current value is the predefined value.
|
||||
/// </summary>
|
||||
public bool IsCurrentValuePredefined
|
||||
{
|
||||
get => _setting.IsCurrentValuePredefined;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean value indicating if this setting had a predefined valid value.
|
||||
/// </summary>
|
||||
public bool IsPredefinedValueValid
|
||||
{
|
||||
get => _setting.IsPredefinedValueValid;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the predefined value of this setting.
|
||||
/// </summary>
|
||||
public object PredefinedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsPredefinedValueValid)
|
||||
{
|
||||
throw new InvalidOperationException("Predefined value is not valid.");
|
||||
}
|
||||
|
||||
return _setting.PredefinedValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the setting identification number
|
||||
/// </summary>
|
||||
public uint SettingId
|
||||
{
|
||||
get => _setting.Id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets additional information regarding this setting including possible valid values
|
||||
/// </summary>
|
||||
public SettingInfo SettingInfo
|
||||
{
|
||||
get => SettingInfo.FromId(SettingId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the profile location of this setting
|
||||
/// </summary>
|
||||
public DRSSettingLocation SettingLocation
|
||||
{
|
||||
get => _setting.SettingLocation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value type of this setting
|
||||
/// </summary>
|
||||
public DRSSettingType SettingType
|
||||
{
|
||||
get => _setting.SettingType;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
string settingName = null;
|
||||
|
||||
try
|
||||
{
|
||||
settingName = SettingInfo.Name;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignore;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(settingName))
|
||||
{
|
||||
settingName = $"#{SettingId:X}";
|
||||
}
|
||||
|
||||
if (IsCurrentValuePredefined)
|
||||
{
|
||||
return $"{settingName} = {CurrentValue ?? "[NULL]"} (Predefined)";
|
||||
}
|
||||
|
||||
return $"{settingName} = {CurrentValue ?? "[NULL]"}";
|
||||
}
|
||||
}
|
||||
}
|
||||
360
app/NvAPIWrapper/DRS/SettingInfo.cs
Normal file
360
app/NvAPIWrapper/DRS/SettingInfo.cs
Normal file
@@ -0,0 +1,360 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using NvAPIWrapper.Native;
|
||||
using NvAPIWrapper.Native.DRS;
|
||||
|
||||
namespace NvAPIWrapper.DRS
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains information about a setting
|
||||
/// </summary>
|
||||
public class SettingInfo
|
||||
{
|
||||
private static uint[] _availableSettingIds;
|
||||
|
||||
private SettingInfo(uint settingId)
|
||||
{
|
||||
SettingId = settingId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an array of available possible valid values.
|
||||
/// </summary>
|
||||
public object[] AvailableValues
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsAvailable)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return DRSApi.EnumAvailableSettingValues(SettingId).Values;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default value of this setting
|
||||
/// </summary>
|
||||
public object DefaultValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsAvailable)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var values = DRSApi.EnumAvailableSettingValues(SettingId);
|
||||
|
||||
return values.DefaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean value indicating if this setting is available on this machine and with the current version of NVIDIA
|
||||
/// driver
|
||||
/// </summary>
|
||||
public bool IsAvailable
|
||||
{
|
||||
get => GetAvailableSetting().Any(info => info.SettingId == SettingId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean value indicating if this setting is know by this library
|
||||
/// </summary>
|
||||
public bool IsKnown
|
||||
{
|
||||
get => IsSettingKnown(SettingId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the description of this setting from the library or <see langword="null" /> if this setting is not known by
|
||||
/// the library.
|
||||
/// </summary>
|
||||
public string KnownDescription
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsKnown || KnownSettingId == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return GetSettingDescription(KnownSettingId.Value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the known identification number of this setting from the library or <see langword="null" /> if this setting is
|
||||
/// not known by the library.
|
||||
/// </summary>
|
||||
public KnownSettingId? KnownSettingId
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsKnown)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return GetKnownSettingId(SettingId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of a static class or an enum containing possible known values for this setting from the library or
|
||||
/// <see langword="null" /> if this setting is not known by the library
|
||||
/// </summary>
|
||||
public Type KnownValueType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsKnown || !IsAvailable)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var name = KnownSettingId.ToString();
|
||||
var nameSpace = typeof(SettingInfo).Namespace + ".SettingValues";
|
||||
|
||||
if (SettingType == DRSSettingType.Integer)
|
||||
{
|
||||
return Assembly.GetExecutingAssembly().GetTypes().FirstOrDefault(type =>
|
||||
type.IsEnum &&
|
||||
type.Namespace?.Equals(nameSpace, StringComparison.InvariantCultureIgnoreCase) == true &&
|
||||
type.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
|
||||
if (SettingType == DRSSettingType.String || SettingType == DRSSettingType.UnicodeString)
|
||||
{
|
||||
return Assembly.GetExecutingAssembly().GetTypes().FirstOrDefault(type =>
|
||||
type.IsClass &&
|
||||
type.Namespace?.Equals(nameSpace, StringComparison.InvariantCultureIgnoreCase) == true &&
|
||||
type.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the setting from NVIDIA driver or <see langword="null" /> if the setting is not available on this
|
||||
/// machine.
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsAvailable)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return DRSApi.GetSettingNameFromId(SettingId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the setting identification number
|
||||
/// </summary>
|
||||
public uint SettingId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value type of the setting from NVIDIA driver or <see langword="null" /> if the setting is not available on
|
||||
/// this machine.
|
||||
/// </summary>
|
||||
public DRSSettingType? SettingType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsAvailable)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var values = DRSApi.EnumAvailableSettingValues(SettingId);
|
||||
|
||||
return values.SettingType;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets information regarding a setting from its identification number.
|
||||
/// </summary>
|
||||
/// <param name="settingId">The identification number of the setting to get information about.</param>
|
||||
/// <returns>An instance of <see cref="SettingInfo" /> containing information about the setting.</returns>
|
||||
public static SettingInfo FromId(uint settingId)
|
||||
{
|
||||
return new SettingInfo(settingId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets information regarding a setting from its known identification number.
|
||||
/// </summary>
|
||||
/// <param name="settingId">The known identification number of the setting to get information about.</param>
|
||||
/// <returns>An instance of <see cref="SettingInfo" /> containing information about the setting.</returns>
|
||||
public static SettingInfo FromKnownSettingId(KnownSettingId settingId)
|
||||
{
|
||||
return FromId(GetSettingId(settingId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets information regarding a setting from its name.
|
||||
/// </summary>
|
||||
/// <param name="settingName">The name of the setting to get information about.</param>
|
||||
/// <returns>An instance of <see cref="SettingInfo" /> containing information about the setting.</returns>
|
||||
public static SettingInfo FromName(string settingName)
|
||||
{
|
||||
var settingId = DRSApi.GetSettingIdFromName(settingName);
|
||||
|
||||
return FromId(settingId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of all available setting on this machine
|
||||
/// </summary>
|
||||
/// <returns>Instances of <see cref="SettingInfo" /> each representing a available setting on this machine.</returns>
|
||||
public static SettingInfo[] GetAvailableSetting()
|
||||
{
|
||||
if (_availableSettingIds == null)
|
||||
{
|
||||
_availableSettingIds = DRSApi.EnumAvailableSettingIds();
|
||||
}
|
||||
|
||||
return _availableSettingIds.Select(FromId).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the known identification number of a setting from its identification number
|
||||
/// </summary>
|
||||
/// <param name="settingId">The setting identification number.</param>
|
||||
/// <returns>The known setting identification number if the setting is known; otherwise <see langword="null" />.</returns>
|
||||
public static KnownSettingId? GetKnownSettingId(uint settingId)
|
||||
{
|
||||
if (!IsSettingKnown(settingId))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (KnownSettingId) settingId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the known setting description from its identification number
|
||||
/// </summary>
|
||||
/// <param name="knownSettingId">The known setting identification number.</param>
|
||||
/// <returns>The known setting description if available; otherwise <see langword="null" />.</returns>
|
||||
public static string GetSettingDescription(KnownSettingId knownSettingId)
|
||||
{
|
||||
var enumName = Enum.GetName(typeof(KnownSettingId), knownSettingId);
|
||||
|
||||
if (enumName == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var enumField = typeof(KnownSettingId).GetField(enumName);
|
||||
|
||||
if (enumField == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var descriptionAttribute = enumField
|
||||
.GetCustomAttributes(typeof(DescriptionAttribute), false)
|
||||
.OfType<DescriptionAttribute>()
|
||||
.FirstOrDefault();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(descriptionAttribute?.Description))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return descriptionAttribute.Description;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the identification number of a setting from its known identification number
|
||||
/// </summary>
|
||||
/// <param name="knownSettingId">The known setting identification number.</param>
|
||||
/// <returns>The setting identification number.</returns>
|
||||
public static uint GetSettingId(KnownSettingId knownSettingId)
|
||||
{
|
||||
return (uint) knownSettingId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a setting is known by this library.
|
||||
/// </summary>
|
||||
/// <param name="settingId">The setting identification number.</param>
|
||||
/// <returns>true if setting is known by this library; otherwise false.</returns>
|
||||
public static bool IsSettingKnown(uint settingId)
|
||||
{
|
||||
return Enum.IsDefined(typeof(KnownSettingId), settingId);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
try
|
||||
{
|
||||
var settingName = Name;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(settingName))
|
||||
{
|
||||
return settingName;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignore;
|
||||
}
|
||||
|
||||
return $"#{SettingId:X}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to resolve the name of a known value using its actual value
|
||||
/// </summary>
|
||||
/// <param name="value">The actual value</param>
|
||||
/// <returns>The name of the known value member.</returns>
|
||||
public string ResolveKnownValueName(object value)
|
||||
{
|
||||
if (!IsKnown)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var valueType = KnownValueType;
|
||||
|
||||
if (valueType == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (valueType.IsEnum)
|
||||
{
|
||||
return Enum.GetName(valueType, value);
|
||||
}
|
||||
|
||||
var comparerType = typeof(EqualityComparer<>).MakeGenericType(value.GetType());
|
||||
var comparer = comparerType.GetProperty(nameof(EqualityComparer<object>.Default))?.GetValue(null);
|
||||
|
||||
if (!(comparer is IEqualityComparer equalityComparer))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return valueType.GetFields()
|
||||
.FirstOrDefault(info =>
|
||||
info.IsStatic &&
|
||||
equalityComparer.Equals(info.GetValue(null), value)
|
||||
)?.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
17
app/NvAPIWrapper/DRS/SettingValues/AmbientOcclusionMode.cs
Normal file
17
app/NvAPIWrapper/DRS/SettingValues/AmbientOcclusionMode.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum AmbientOcclusionMode : uint
|
||||
{
|
||||
Off = 0x0,
|
||||
|
||||
Low = 0x1,
|
||||
|
||||
Medium = 0x2,
|
||||
|
||||
High = 0x3,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum AmbientOcclusionModeActive : uint
|
||||
{
|
||||
Disabled = 0x0,
|
||||
|
||||
Enabled = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
17
app/NvAPIWrapper/DRS/SettingValues/AnisotropicModeLevel.cs
Normal file
17
app/NvAPIWrapper/DRS/SettingValues/AnisotropicModeLevel.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum AnisotropicModeLevel : uint
|
||||
{
|
||||
Mask = 0xFFFF,
|
||||
|
||||
NonePoint = 0x0,
|
||||
|
||||
NoneLinear = 0x1,
|
||||
|
||||
Maximum = 0x10,
|
||||
|
||||
Default = 0x1
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum AnisotropicModeSelector : uint
|
||||
{
|
||||
Mask = 0xF,
|
||||
|
||||
Application = 0x0,
|
||||
|
||||
User = 0x1,
|
||||
|
||||
Condition = 0x2,
|
||||
|
||||
Maximum = 0x2,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
13
app/NvAPIWrapper/DRS/SettingValues/AnselAllow.cs
Normal file
13
app/NvAPIWrapper/DRS/SettingValues/AnselAllow.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum AnselAllow : uint
|
||||
{
|
||||
Disallowed = 0x0,
|
||||
|
||||
Allowed = 0x1,
|
||||
|
||||
Default = 0x1
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
13
app/NvAPIWrapper/DRS/SettingValues/AnselEnable.cs
Normal file
13
app/NvAPIWrapper/DRS/SettingValues/AnselEnable.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum AnselEnable : uint
|
||||
{
|
||||
Off = 0x0,
|
||||
|
||||
On = 0x1,
|
||||
|
||||
Default = 0x1
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
13
app/NvAPIWrapper/DRS/SettingValues/AnselWhiteListed.cs
Normal file
13
app/NvAPIWrapper/DRS/SettingValues/AnselWhiteListed.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum AnselWhiteListed : uint
|
||||
{
|
||||
Disallowed = 0x0,
|
||||
|
||||
Allowed = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum AntiAliasingBehaviorFlags : uint
|
||||
{
|
||||
None = 0x0,
|
||||
|
||||
TreatOverrideAsApplicationControlled = 0x1,
|
||||
|
||||
TreatOverrideAsEnhance = 0x2,
|
||||
|
||||
DisableOverride = 0x3,
|
||||
|
||||
TreatEnhanceAsApplicationControlled = 0x4,
|
||||
|
||||
TreatEnhanceAsOverride = 0x8,
|
||||
|
||||
DisableEnhance = 0xC,
|
||||
|
||||
MapVCAAToMultiSampling = 0x10000,
|
||||
|
||||
SLIDisableTransparencySupersampling = 0x20000,
|
||||
|
||||
DisableCplaa = 0x40000,
|
||||
|
||||
SkipRTDIMCheckForEnhance = 0x80000,
|
||||
|
||||
DisableSLIAntiAliasing = 0x100000,
|
||||
|
||||
Default = 0x0,
|
||||
|
||||
AntiAliasingRTBPPDIV4 = 0xF0000000,
|
||||
|
||||
AntiAliasingRTBPPDIV4Shift = 0x1C,
|
||||
|
||||
NonAntiAliasingRTBPPDIV4 = 0xF000000,
|
||||
|
||||
NonAntiAliasingRTBPPDIV4Shift = 0x18,
|
||||
|
||||
Mask = 0xFF1F000F
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum AntiAliasingModeAlphaToCoverage : uint
|
||||
{
|
||||
ModeMask = 0x4,
|
||||
|
||||
ModeOff = 0x0,
|
||||
|
||||
ModeOn = 0x4,
|
||||
|
||||
ModeMaximum = 0x4,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum AntiAliasingModeGammaCorrection : uint
|
||||
{
|
||||
Mask = 0x3,
|
||||
|
||||
Off = 0x0,
|
||||
|
||||
OnIfFOS = 0x1,
|
||||
|
||||
OnAlways = 0x2,
|
||||
|
||||
Maximum = 0x2,
|
||||
|
||||
Default = 0x0,
|
||||
|
||||
DefaultTesla = 0x2,
|
||||
|
||||
DefaultFermi = 0x2
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
109
app/NvAPIWrapper/DRS/SettingValues/AntiAliasingModeMethod.cs
Normal file
109
app/NvAPIWrapper/DRS/SettingValues/AntiAliasingModeMethod.cs
Normal file
@@ -0,0 +1,109 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum AntiAliasingModeMethod : uint
|
||||
{
|
||||
None = 0x0,
|
||||
|
||||
SuperSample2XHorizontal = 0x1,
|
||||
|
||||
SuperSample2XVertical = 0x2,
|
||||
|
||||
SuperSample15X15 = 0x2,
|
||||
|
||||
Free0X03 = 0x3,
|
||||
|
||||
Free0X04 = 0x4,
|
||||
|
||||
SuperSample4X = 0x5,
|
||||
|
||||
SuperSample4XBias = 0x6,
|
||||
|
||||
SuperSample4XGaussian = 0x7,
|
||||
|
||||
Free0X08 = 0x8,
|
||||
|
||||
Free0X09 = 0x9,
|
||||
|
||||
SuperSample9X = 0xA,
|
||||
|
||||
SuperSample9XBias = 0xB,
|
||||
|
||||
SuperSample16X = 0xC,
|
||||
|
||||
SuperSample16XBias = 0xD,
|
||||
|
||||
MultiSample2XDiagonal = 0xE,
|
||||
|
||||
MultiSample2XQuincunx = 0xF,
|
||||
|
||||
MultiSample4X = 0x10,
|
||||
|
||||
Free0X11 = 0x11,
|
||||
|
||||
MultiSample4XGaussian = 0x12,
|
||||
|
||||
MixedSample4XSkewed4Tap = 0x13,
|
||||
|
||||
Free0X14 = 0x14,
|
||||
|
||||
Free0X15 = 0x15,
|
||||
|
||||
MixedSample6X = 0x16,
|
||||
|
||||
MixedSample6XSkewed6Tap = 0x17,
|
||||
|
||||
MixedSample8X = 0x18,
|
||||
|
||||
MixedSample8XSkewed8Tap = 0x19,
|
||||
|
||||
MixedSample16X = 0x1A,
|
||||
|
||||
MultiSample4XGamma = 0x1B,
|
||||
|
||||
MultiSample16X = 0x1C,
|
||||
|
||||
VCAA32X8V24 = 0x1D,
|
||||
|
||||
CorruptionCheck = 0x1E,
|
||||
|
||||
_6XCT = 0x1F,
|
||||
|
||||
MultiSample2XDiagonalGamma = 0x20,
|
||||
|
||||
SuperSample4XGamma = 0x21,
|
||||
|
||||
MultiSample4XFosgamma = 0x22,
|
||||
|
||||
MultiSample2XDiagonalFosgamma = 0x23,
|
||||
|
||||
SuperSample4XFosgamma = 0x24,
|
||||
|
||||
MultiSample8X = 0x25,
|
||||
|
||||
VCAA8X4V4 = 0x26,
|
||||
|
||||
VCAA16X4V12 = 0x27,
|
||||
|
||||
VCAA16X8V8 = 0x28,
|
||||
|
||||
MixedSample32X = 0x29,
|
||||
|
||||
SuperVCAA64X4V12 = 0x2A,
|
||||
|
||||
SuperVCAA64X8V8 = 0x2B,
|
||||
|
||||
MixedSample64X = 0x2C,
|
||||
|
||||
MixedSample128X = 0x2D,
|
||||
|
||||
Count = 0x2E,
|
||||
|
||||
MethodMask = 0xFFFF,
|
||||
|
||||
MethodMaximum = 0xF1C57815,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
49
app/NvAPIWrapper/DRS/SettingValues/AntiAliasingModeReplay.cs
Normal file
49
app/NvAPIWrapper/DRS/SettingValues/AntiAliasingModeReplay.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum AntiAliasingModeReplay : uint
|
||||
{
|
||||
SamplesMask = 0x70,
|
||||
|
||||
SamplesOne = 0x0,
|
||||
|
||||
SamplesTwo = 0x10,
|
||||
|
||||
SamplesFour = 0x20,
|
||||
|
||||
SamplesEight = 0x30,
|
||||
|
||||
SamplesMaximum = 0x30,
|
||||
|
||||
ModeMask = 0xF,
|
||||
|
||||
ModeOff = 0x0,
|
||||
|
||||
ModeAlphaTest = 0x1,
|
||||
|
||||
ModePixelKill = 0x2,
|
||||
|
||||
ModeDynamicBranch = 0x4,
|
||||
|
||||
ModeOptimal = 0x4,
|
||||
|
||||
ModeAll = 0x8,
|
||||
|
||||
ModeMaximum = 0xF,
|
||||
|
||||
Transparency = 0x23,
|
||||
|
||||
DisAllowTraa = 0x100,
|
||||
|
||||
TransparencyDefault = 0x0,
|
||||
|
||||
TransparencyDefaultTesla = 0x0,
|
||||
|
||||
TransparencyDefaultFermi = 0x0,
|
||||
|
||||
Mask = 0x17F,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum AntiAliasingModeSelector : uint
|
||||
{
|
||||
Mask = 0x3,
|
||||
|
||||
ApplicationControl = 0x0,
|
||||
|
||||
Override = 0x1,
|
||||
|
||||
Enhance = 0x2,
|
||||
|
||||
Maximum = 0x2,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum AntiAliasingModeSelectorSLIAntiAliasing : uint
|
||||
{
|
||||
Disabled = 0x0,
|
||||
|
||||
Enabled = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum ApplicationProfileNotificationTimeOut : uint
|
||||
{
|
||||
Disabled = 0x0,
|
||||
|
||||
NineSeconds = 0x9,
|
||||
|
||||
FifteenSeconds = 0xF,
|
||||
|
||||
ThirtySeconds = 0x1E,
|
||||
|
||||
OneMinute = 0x3C,
|
||||
|
||||
TwoMinutes = 0x78,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
13
app/NvAPIWrapper/DRS/SettingValues/AutoLODBiasAdjust.cs
Normal file
13
app/NvAPIWrapper/DRS/SettingValues/AutoLODBiasAdjust.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum AutoLODBiasAdjust : uint
|
||||
{
|
||||
Off = 0x0,
|
||||
|
||||
On = 0x1,
|
||||
|
||||
Default = 0x1
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
17
app/NvAPIWrapper/DRS/SettingValues/BatteryBoost.cs
Normal file
17
app/NvAPIWrapper/DRS/SettingValues/BatteryBoost.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum BatteryBoost : uint
|
||||
{
|
||||
Minimum = 0x1,
|
||||
|
||||
Maximum = 0xFF,
|
||||
|
||||
Enabled = 0x10000000,
|
||||
|
||||
Disabled = 0x0,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
10
app/NvAPIWrapper/DRS/SettingValues/CUDAExcludedGPUs.cs
Normal file
10
app/NvAPIWrapper/DRS/SettingValues/CUDAExcludedGPUs.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public static class CUDAExcludedGPUs
|
||||
{
|
||||
public const string Default = "none";
|
||||
public const string None = "none";
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum ControlPanelHiddenProfile : uint
|
||||
{
|
||||
Disabled = 0x0,
|
||||
|
||||
Enabled = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public static class D3DOpenGLGPUMaximumPower
|
||||
{
|
||||
public const string Default = "0";
|
||||
public const string DefaultPower = "0";
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum ExportPerformanceCounters : uint
|
||||
{
|
||||
Off = 0x0,
|
||||
|
||||
On = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum ExportPerformanceCountersDX9Only : uint
|
||||
{
|
||||
Off = 0x0,
|
||||
|
||||
On = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
13
app/NvAPIWrapper/DRS/SettingValues/FXAAAllow.cs
Normal file
13
app/NvAPIWrapper/DRS/SettingValues/FXAAAllow.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum FXAAAllow : uint
|
||||
{
|
||||
Disallowed = 0x0,
|
||||
|
||||
Allowed = 0x1,
|
||||
|
||||
Default = 0x1
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
13
app/NvAPIWrapper/DRS/SettingValues/FXAAEnable.cs
Normal file
13
app/NvAPIWrapper/DRS/SettingValues/FXAAEnable.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum FXAAEnable : uint
|
||||
{
|
||||
Off = 0x0,
|
||||
|
||||
On = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
13
app/NvAPIWrapper/DRS/SettingValues/FXAAIndicatorEnable.cs
Normal file
13
app/NvAPIWrapper/DRS/SettingValues/FXAAIndicatorEnable.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum FXAAIndicatorEnable : uint
|
||||
{
|
||||
Off = 0x0,
|
||||
|
||||
On = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
13
app/NvAPIWrapper/DRS/SettingValues/LODBiasAdjust.cs
Normal file
13
app/NvAPIWrapper/DRS/SettingValues/LODBiasAdjust.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum LODBiasAdjust : uint
|
||||
{
|
||||
Minimum = 0xFFFFFF80,
|
||||
|
||||
Maximum = 0x80,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
13
app/NvAPIWrapper/DRS/SettingValues/MCSFRShowSplit.cs
Normal file
13
app/NvAPIWrapper/DRS/SettingValues/MCSFRShowSplit.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum MCSFRShowSplit : uint
|
||||
{
|
||||
Disabled = 0x34534064,
|
||||
|
||||
Enabled = 0x24545582,
|
||||
|
||||
Default = 0x34534064
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum MaxwellBSampleInterleave : uint
|
||||
{
|
||||
Off = 0x0,
|
||||
|
||||
On = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
13
app/NvAPIWrapper/DRS/SettingValues/NvidiaQualityUpScaling.cs
Normal file
13
app/NvAPIWrapper/DRS/SettingValues/NvidiaQualityUpScaling.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum NvidiaQualityUpScaling : uint
|
||||
{
|
||||
Off = 0x0,
|
||||
|
||||
On = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum OpenGLAntiAliasingLineGamma : uint
|
||||
{
|
||||
Disabled = 0x10,
|
||||
|
||||
Enabled = 0x23,
|
||||
|
||||
Minimum = 0x1,
|
||||
|
||||
Maximum = 0x64,
|
||||
|
||||
Default = 0x10
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
13
app/NvAPIWrapper/DRS/SettingValues/OpenGLDeepColorScanOut.cs
Normal file
13
app/NvAPIWrapper/DRS/SettingValues/OpenGLDeepColorScanOut.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum OpenGLDeepColorScanOut : uint
|
||||
{
|
||||
Disable = 0x0,
|
||||
|
||||
Enable = 0x1,
|
||||
|
||||
Default = 0x1
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum OpenGLDefaultSwapInterval : uint
|
||||
{
|
||||
Tear = 0x0,
|
||||
|
||||
VSyncOne = 0x1,
|
||||
|
||||
VSync = 0x1,
|
||||
|
||||
ValueMask = 0xFFFF,
|
||||
|
||||
ForceMask = 0xF0000000,
|
||||
|
||||
ForceOff = 0xF0000000,
|
||||
|
||||
ForceOn = 0x10000000,
|
||||
|
||||
ApplicationControlled = 0x0,
|
||||
|
||||
Disable = 0xFFFFFFFF,
|
||||
|
||||
Default = 0x1
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum OpenGLDefaultSwapIntervalFractional : uint
|
||||
{
|
||||
ZeroScanLines = 0x0,
|
||||
|
||||
OneFullFrameOfScanLines = 0x64,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum OpenGLDefaultSwapIntervalSign : uint
|
||||
{
|
||||
Positive = 0x0,
|
||||
|
||||
Negative = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum OpenGLEventLogSeverityThreshold : uint
|
||||
{
|
||||
Disable = 0x0,
|
||||
|
||||
Critical = 0x1,
|
||||
|
||||
Warning = 0x2,
|
||||
|
||||
Information = 0x3,
|
||||
|
||||
All = 0x4,
|
||||
|
||||
Default = 0x4
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
13
app/NvAPIWrapper/DRS/SettingValues/OpenGLForceBlit.cs
Normal file
13
app/NvAPIWrapper/DRS/SettingValues/OpenGLForceBlit.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum OpenGLForceBlit : uint
|
||||
{
|
||||
On = 0x1,
|
||||
|
||||
Off = 0x0,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
13
app/NvAPIWrapper/DRS/SettingValues/OpenGLForceStereo.cs
Normal file
13
app/NvAPIWrapper/DRS/SettingValues/OpenGLForceStereo.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum OpenGLForceStereo : uint
|
||||
{
|
||||
Off = 0x0,
|
||||
|
||||
On = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public static class OpenGLImplicitGPUAffinity
|
||||
{
|
||||
public const string AutoSelect = "autoselect";
|
||||
|
||||
public const string Default = "autoselect";
|
||||
public const string EnvironmentVariable = "OGL_DEFAULT_RENDERING_GPU";
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
17
app/NvAPIWrapper/DRS/SettingValues/OpenGLOverlayPixelType.cs
Normal file
17
app/NvAPIWrapper/DRS/SettingValues/OpenGLOverlayPixelType.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum OpenGLOverlayPixelType : uint
|
||||
{
|
||||
None = 0x0,
|
||||
|
||||
CI = 0x1,
|
||||
|
||||
RGBA = 0x2,
|
||||
|
||||
CIAndRGBA = 0x3,
|
||||
|
||||
Default = 0x1
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
15
app/NvAPIWrapper/DRS/SettingValues/OpenGLOverlaySupport.cs
Normal file
15
app/NvAPIWrapper/DRS/SettingValues/OpenGLOverlaySupport.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum OpenGLOverlaySupport : uint
|
||||
{
|
||||
Off = 0x0,
|
||||
|
||||
On = 0x1,
|
||||
|
||||
ForceSoftware = 0x2,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum OpenGLQualityEnhancements : uint
|
||||
{
|
||||
HighQuality = 0xFFFFFFF6,
|
||||
|
||||
Quality = 0x0,
|
||||
|
||||
Performance = 0xA,
|
||||
|
||||
HighPerformance = 0x14,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
17
app/NvAPIWrapper/DRS/SettingValues/OpenGLSLIMulticast.cs
Normal file
17
app/NvAPIWrapper/DRS/SettingValues/OpenGLSLIMulticast.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum OpenGLSLIMulticast : uint
|
||||
{
|
||||
Disable = 0x0,
|
||||
|
||||
Enable = 0x1,
|
||||
|
||||
ForceDisable = 0x2,
|
||||
|
||||
AllowMosaic = 0x4,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum OpenGLSingleBackDepthBuffer : uint
|
||||
{
|
||||
Disable = 0x0,
|
||||
|
||||
Enable = 0x1,
|
||||
|
||||
UseHardwareDefault = 0xFFFFFFFF,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
21
app/NvAPIWrapper/DRS/SettingValues/OpenGLTMONLevel.cs
Normal file
21
app/NvAPIWrapper/DRS/SettingValues/OpenGLTMONLevel.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum OpenGLTMONLevel : uint
|
||||
{
|
||||
Disable = 0x0,
|
||||
|
||||
Critical = 0x1,
|
||||
|
||||
Warning = 0x2,
|
||||
|
||||
Information = 0x3,
|
||||
|
||||
Most = 0x4,
|
||||
|
||||
Verbose = 0x5,
|
||||
|
||||
Default = 0x4
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
13
app/NvAPIWrapper/DRS/SettingValues/OpenGLThreadControl.cs
Normal file
13
app/NvAPIWrapper/DRS/SettingValues/OpenGLThreadControl.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum OpenGLThreadControl : uint
|
||||
{
|
||||
Enable = 0x1,
|
||||
|
||||
Disable = 0x2,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
13
app/NvAPIWrapper/DRS/SettingValues/OpenGLTripleBuffer.cs
Normal file
13
app/NvAPIWrapper/DRS/SettingValues/OpenGLTripleBuffer.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum OpenGLTripleBuffer : uint
|
||||
{
|
||||
Disabled = 0x0,
|
||||
|
||||
Enabled = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum OptimusMaximumAntiAliasing : uint
|
||||
{
|
||||
Minimum = 0x0,
|
||||
|
||||
Maximum = 0x10,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum PerformanceStateFrameRateLimiter : uint
|
||||
{
|
||||
Disabled = 0x0,
|
||||
|
||||
FPS20 = 0x14,
|
||||
|
||||
FPS30 = 0x1E,
|
||||
|
||||
FPS40 = 0x28,
|
||||
|
||||
Fpsmask = 0xFF,
|
||||
|
||||
NoAlign = 0x4000,
|
||||
|
||||
BBQM = 0x8000,
|
||||
|
||||
LowerFPSToAlign = 0x20000,
|
||||
|
||||
ForceVSyncOff = 0x40000,
|
||||
|
||||
GpsWeb = 0x80000,
|
||||
|
||||
Disallowed = 0x200000,
|
||||
|
||||
UseCPUWait = 0x400000,
|
||||
|
||||
NoLagOffset = 0x800000,
|
||||
|
||||
Accurate = 0x10000000,
|
||||
|
||||
AllowWindowed = 0x20000000,
|
||||
|
||||
ForceOn = 0x40000000,
|
||||
|
||||
Enabled = 0x80000000,
|
||||
|
||||
OpenGLRemoteDesktop = 0xE000003C,
|
||||
|
||||
Mask = 0xF0EEC0FF,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum PerformanceStateFrameRateLimiter2Control : uint
|
||||
{
|
||||
DelayCE = 0x0,
|
||||
|
||||
Delay3D = 0x1,
|
||||
|
||||
AvoidNoop = 0x2,
|
||||
|
||||
DelayCEPresent3D = 0x8,
|
||||
|
||||
AllowAllMaxwell = 0x10,
|
||||
|
||||
AllowAll = 0x20,
|
||||
|
||||
ForceOff = 0x40,
|
||||
|
||||
EnableVCE = 0x80,
|
||||
|
||||
DefaultForGM10X = 0x11,
|
||||
|
||||
Default = 0x88
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum PerformanceStateFrameRateLimiterGpsControl : uint
|
||||
{
|
||||
Disabled = 0x0,
|
||||
|
||||
DecreaseFilterMask = 0x1FF,
|
||||
|
||||
PauseTimeMask = 0xFE00,
|
||||
|
||||
PauseTimeShift = 0x9,
|
||||
|
||||
TargetRenderTimeMask = 0xFF0000,
|
||||
|
||||
TargetRenderTimeShift = 0x10,
|
||||
|
||||
PerformanceStepSizeMask = 0x1F000000,
|
||||
|
||||
PerformanceStepSizeShift = 0x18,
|
||||
|
||||
IncreaseFilterMask = 0xE0000000,
|
||||
|
||||
IncreaseFilterShift = 0x1D,
|
||||
|
||||
OptimalSetting = 0x4A5A3219,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum PerformanceStateFrameRateMonitorControl : uint
|
||||
{
|
||||
Disabled = 0x0,
|
||||
|
||||
ThresholdPctMask = 0xFF,
|
||||
|
||||
MovingAverageXMask = 0xF00,
|
||||
|
||||
MovingAverageXShift = 0x8,
|
||||
|
||||
EnableFineGrained = 0x400000,
|
||||
|
||||
EnableOnVSync = 0x800000,
|
||||
|
||||
VSyncOffsetMask = 0xF000,
|
||||
|
||||
VSyncOffsetShift = 0xC,
|
||||
|
||||
FPSUseFrl = 0x0,
|
||||
|
||||
FPS30 = 0x1E000000,
|
||||
|
||||
FPS60 = 0x3C000000,
|
||||
|
||||
FPSMask = 0xFF000000,
|
||||
|
||||
FPSShift = 0x18,
|
||||
|
||||
OptimalSetting = 0x364,
|
||||
|
||||
VSyncOptimalSetting = 0x80F364,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum PerformanceStateShaderDiskCache : uint
|
||||
{
|
||||
Off = 0x0,
|
||||
|
||||
On = 0x1,
|
||||
|
||||
Default = 0x1
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum PerformanceStateTextureFilteringAnisotropicOptimization : uint
|
||||
{
|
||||
Off = 0x0,
|
||||
|
||||
On = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum PerformanceStateTextureFilteringBiLinearInAnisotropic : uint
|
||||
{
|
||||
Off = 0x0,
|
||||
|
||||
On = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum PerformanceStateTextureFilteringDisableTrilinearSlope : uint
|
||||
{
|
||||
Off = 0x0,
|
||||
|
||||
On = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum PerformanceStateTextureFilteringNoNegativeLODBias : uint
|
||||
{
|
||||
Off = 0x0,
|
||||
|
||||
On = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
13
app/NvAPIWrapper/DRS/SettingValues/PhysxIndicator.cs
Normal file
13
app/NvAPIWrapper/DRS/SettingValues/PhysxIndicator.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum PhysxIndicator : uint
|
||||
{
|
||||
Disabled = 0x34534064,
|
||||
|
||||
Enabled = 0x24545582,
|
||||
|
||||
Default = 0x34534064
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
15
app/NvAPIWrapper/DRS/SettingValues/PreRenderLimit.cs
Normal file
15
app/NvAPIWrapper/DRS/SettingValues/PreRenderLimit.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum PreRenderLimit : uint
|
||||
{
|
||||
Minimum = 0x0,
|
||||
|
||||
Maximum = 0xFF,
|
||||
|
||||
ApplicationControlled = 0x0,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum PreferredPerformanceState : uint
|
||||
{
|
||||
Adaptive = 0x0,
|
||||
|
||||
PreferMaximum = 0x1,
|
||||
|
||||
DriverControlled = 0x2,
|
||||
|
||||
PreferConsistentPerformance = 0x3,
|
||||
|
||||
PreferMinimum = 0x4,
|
||||
|
||||
OptimalPower = 0x5,
|
||||
|
||||
Minimum = 0x0,
|
||||
|
||||
Maximum = 0x5,
|
||||
|
||||
Default = 0x5
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum PreventUiAnisotropicOverride : uint
|
||||
{
|
||||
Off = 0x0,
|
||||
|
||||
On = 0x1,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
17
app/NvAPIWrapper/DRS/SettingValues/QualityEnhancements.cs
Normal file
17
app/NvAPIWrapper/DRS/SettingValues/QualityEnhancements.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum QualityEnhancements : uint
|
||||
{
|
||||
HighQuality = 0xFFFFFFF6,
|
||||
|
||||
Quality = 0x0,
|
||||
|
||||
Performance = 0xA,
|
||||
|
||||
HighPerformance = 0x14,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
15
app/NvAPIWrapper/DRS/SettingValues/RefreshRateOverride.cs
Normal file
15
app/NvAPIWrapper/DRS/SettingValues/RefreshRateOverride.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum RefreshRateOverride : uint
|
||||
{
|
||||
ApplicationControlled = 0x0,
|
||||
|
||||
HighestAvailable = 0x1,
|
||||
|
||||
LowLatencyRefreshRateMask = 0xFF0,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
19
app/NvAPIWrapper/DRS/SettingValues/SLIGPUCount.cs
Normal file
19
app/NvAPIWrapper/DRS/SettingValues/SLIGPUCount.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum SLIGPUCount : uint
|
||||
{
|
||||
AutoSelect = 0x0,
|
||||
|
||||
One = 0x1,
|
||||
|
||||
Two = 0x2,
|
||||
|
||||
Three = 0x3,
|
||||
|
||||
Four = 0x4,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
19
app/NvAPIWrapper/DRS/SettingValues/SLIPredefinedGPUCount.cs
Normal file
19
app/NvAPIWrapper/DRS/SettingValues/SLIPredefinedGPUCount.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum SLIPredefinedGPUCount : uint
|
||||
{
|
||||
AutoSelect = 0x0,
|
||||
|
||||
One = 0x1,
|
||||
|
||||
Two = 0x2,
|
||||
|
||||
Three = 0x3,
|
||||
|
||||
Four = 0x4,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum SLIPredefinedGPUCountDX10 : uint
|
||||
{
|
||||
AutoSelect = 0x0,
|
||||
|
||||
One = 0x1,
|
||||
|
||||
Two = 0x2,
|
||||
|
||||
Three = 0x3,
|
||||
|
||||
Four = 0x4,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
21
app/NvAPIWrapper/DRS/SettingValues/SLIPredefinedMode.cs
Normal file
21
app/NvAPIWrapper/DRS/SettingValues/SLIPredefinedMode.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace NvAPIWrapper.DRS.SettingValues
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
public enum SLIPredefinedMode : uint
|
||||
{
|
||||
AutoSelect = 0x0,
|
||||
|
||||
ForceSingle = 0x1,
|
||||
|
||||
ForceAFR = 0x2,
|
||||
|
||||
ForceAFR2 = 0x3,
|
||||
|
||||
ForceSFR = 0x4,
|
||||
|
||||
ForceAFROfSFRFallback3AFR = 0x5,
|
||||
|
||||
Default = 0x0
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user