Compare commits

...

76 Commits
v0.27 ... v0.34

Author SHA1 Message Date
seerge
06be8c726e Improved Animatrix rendering 2023-03-20 23:27:13 +01:00
seerge
265c6ce417 - 2023-03-20 21:09:11 +01:00
seerge
add852ce5d Animatrix tweaks 2023-03-20 21:07:05 +01:00
seerge
d4a5164b16 - 2023-03-20 19:18:07 +01:00
seerge
14618ee19e Possible fix for theme switching 2023-03-20 19:04:41 +01:00
seerge
0b3a75e373 Minor tweaks 2023-03-20 18:02:38 +01:00
seerge
64e390a61f UI tweaks 2023-03-20 17:10:18 +01:00
seerge
1cd808de07 Auto theme change 2023-03-20 16:42:51 +01:00
seerge
d82f1c8d70 Fix crash for gputemp reader 2023-03-20 15:43:51 +01:00
seerge
9189cf0a46 Dark Theme 2023-03-20 14:38:56 +01:00
seerge
3a7c4278a0 Merge branch 'main' of https://github.com/seerge/g-helper 2023-03-20 14:32:47 +01:00
seerge
7065ba8661 Dark Theme 2023-03-20 14:32:45 +01:00
Serge
1bce4a4b51 Update README.md 2023-03-20 11:45:16 +01:00
Serge
468f9c4034 Update bug_report.md 2023-03-19 23:45:02 +01:00
seerge
4d347df45c Attempt to fix auto gpu switch 2023-03-19 21:59:22 +01:00
seerge
d7f1d1d5fd Merge branch 'main' of https://github.com/seerge/g-helper 2023-03-19 17:39:32 +01:00
seerge
6800ae38dd Custom fan-axis for 401 model 2023-03-19 17:39:30 +01:00
Serge
9b2b96fbf0 Update README.md 2023-03-19 13:57:02 +01:00
seerge
04b3a15d8f Merge branch 'main' of https://github.com/seerge/g-helper 2023-03-19 10:27:35 +01:00
seerge
aae0570340 - 2023-03-19 10:27:32 +01:00
Serge
b142d566da Update README.md 2023-03-18 20:56:37 +01:00
seerge
a9115d0dff Screenshot 2023-03-18 18:46:35 +01:00
Serge
e3a3e81245 Merge pull request #96 from seerge/new_ui
New UI
2023-03-18 18:38:35 +01:00
seerge
c50c1807ca UI fixes, tooltips for fan control 2023-03-18 17:57:09 +01:00
seerge
5767320437 Fixes for scaling, and layout 2023-03-18 15:13:34 +01:00
seerge
74846097db Optimized icons 2023-03-17 22:39:53 +01:00
seerge
5b89556ed3 New UI 2023-03-17 22:28:33 +01:00
Serge
845b182b55 Update README.md 2023-03-17 15:28:41 +01:00
Serge
b7cfd04560 Rename stop-asus-sv.bat to debloat.bat 2023-03-17 15:28:23 +01:00
Serge
6ffd464ec4 Update README.md 2023-03-17 15:14:04 +01:00
seerge
e7dd3ce203 - 2023-03-17 15:13:49 +01:00
Serge
d06dae9015 Update README.md 2023-03-17 15:11:44 +01:00
Serge
1b208e1a74 Update README.md 2023-03-17 15:11:00 +01:00
seerge
6befab190b Folders 2023-03-17 15:10:39 +01:00
seerge
5d3eaa0055 Merge branch 'main' of https://github.com/seerge/g-helper 2023-03-17 15:08:03 +01:00
seerge
667f1a997c Folder cleanup 2023-03-17 15:08:01 +01:00
Serge
4542221a58 Update README.md 2023-03-17 15:03:58 +01:00
seerge
5fd7b74519 Folder reorganisation 2023-03-17 15:03:09 +01:00
Serge
014ee635d6 Update README.md 2023-03-17 01:31:24 +01:00
Serge
1dff60d574 Create default.html 2023-03-17 01:18:00 +01:00
Serge
7395f0be69 Update README.md 2023-03-16 23:07:38 +01:00
seerge
e3019a313a UI fixes 2023-03-16 22:59:50 +01:00
seerge
9653b81cd3 Revert "Update _config.yml"
This reverts commit 9713cb6fa4.
2023-03-16 22:59:34 +01:00
Serge
9713cb6fa4 Update _config.yml 2023-03-16 22:51:51 +01:00
Serge
10053eda10 Update _config.yml 2023-03-16 22:42:42 +01:00
Serge
ef1bbc1fce Update _config.yml 2023-03-16 22:36:31 +01:00
seerge
3fde8c1fa9 Screenshot 2023-03-16 18:56:09 +01:00
seerge
efd6707e61 Merge branch 'main' of https://github.com/seerge/g14-helper 2023-03-16 15:39:27 +01:00
seerge
8032ea3fc7 UI tweaks 2023-03-16 15:39:25 +01:00
Serge
d0a232d888 Update README.md 2023-03-15 22:55:42 +01:00
Serge
a6bd18f019 Update README.md 2023-03-15 22:53:16 +01:00
seerge
a09c252c2e Merge branch 'main' of https://github.com/seerge/g14-helper 2023-03-15 21:25:51 +01:00
seerge
99d3c61897 Kill app on Eco switch 2023-03-15 21:25:49 +01:00
Serge
4a6decb0be Update README.md 2023-03-15 21:25:10 +01:00
Serge
80b9fdb8ac Update README.md 2023-03-15 19:14:49 +01:00
Serge
e3c293942c Update README.md 2023-03-15 17:47:38 +01:00
Serge
42e910e635 Create _config.yml 2023-03-15 17:44:18 +01:00
Serge
18b6ae07b2 Update README.md 2023-03-15 17:30:17 +01:00
Serge
fa2875fbee Update README.md 2023-03-15 17:29:17 +01:00
Serge
f2bfb24fb4 Update README.md 2023-03-15 17:27:22 +01:00
Serge
adc81721ac Update README.md 2023-03-15 17:21:50 +01:00
Serge
9da061d621 Update README.md 2023-03-15 17:12:07 +01:00
Serge
274c04bf61 Update README.md 2023-03-15 14:15:29 +01:00
Serge
2d286ca04f Update README.md 2023-03-15 14:14:47 +01:00
Serge
2c1fa01863 Create SECURITY.md 2023-03-15 14:11:46 +01:00
Serge
0370ef7bc0 Update issue templates 2023-03-15 14:10:33 +01:00
Serge
2f2ef23ee4 Create CONTRIBUTING.md 2023-03-15 14:09:57 +01:00
Serge
756ed44741 Create CODE_OF_CONDUCT.md 2023-03-15 14:08:49 +01:00
Serge
efb6a087b4 Merge pull request #86 from seerge/add-license-1
Create LICENSE
2023-03-15 14:07:13 +01:00
Serge
4e6f55c24d Create LICENSE 2023-03-15 14:05:01 +01:00
Serge
c029df357a Update README.md 2023-03-15 12:45:49 +01:00
Serge
8d19b5f89c Update README.md 2023-03-15 12:24:54 +01:00
seerge
7683e68df3 Merge branch 'main' of https://github.com/seerge/g14-helper 2023-03-14 23:07:52 +01:00
seerge
e45bcdf8a5 Adjusted PPTs for 2021 model, added windows PowerModes 2023-03-14 23:07:49 +01:00
Serge
ab8d42c216 Update README.md 2023-03-14 17:55:25 +01:00
seerge
d248fcf384 Screenshot 2023-03-14 17:53:15 +01:00
90 changed files with 2352 additions and 801 deletions

128
.github/CODE_OF_CONDUCT.md vendored Normal file
View File

@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

1
.github/CONTRIBUTING.md vendored Normal file
View File

@@ -0,0 +1 @@
Please, feel free to contribute. Especially if you own model differnt from G14 2022 and can offer extra features or support.

31
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Laptop model
**Additional context**
Add any other context about the problem here.

10
.github/ISSUE_TEMPLATE/custom.md vendored Normal file
View File

@@ -0,0 +1,10 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''
---

View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

16
.github/SECURITY.md vendored Normal file
View File

@@ -0,0 +1,16 @@
# Security Policy
## Supported Versions
| Version | Supported |
| ------- | ------------------ |
| 0.25+ | :white_check_mark: |
| < 0.24 | :x: |
## Reporting a Vulnerability
Use this section to tell people how to report a vulnerability.
Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Serge
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,8 +0,0 @@
{
"profiles": {
"GHelper": {
"commandName": "Project",
"workingDirectory": "C:\\Users\\serge\\source\\GHelper"
}
}
}

View File

@@ -1,79 +0,0 @@
# G-Helper / GHelper
## For Asus ROG Zephyrus G14, G15, Flow X13, Flow X16, and other models
A small utility that allows you do almost everyting you could do with Armory Crate but without extra bloat and unnecessary services.
### [Download latest release](https://github.com/seerge/g-helper/releases)
![Screenshot](https://raw.githubusercontent.com/seerge/g-helper/main/screenshot.png)
## NEW (and experimental) features
1. Set Power limits (PPT) for Total (APU + dGPU) and CPU.
2. Anime matrix control thanks to [Starlight](https://github.com/vddCore/Starlight) + some tweaks from my side
## Main features
1. Switch between built-in system **Performance modes** Silent / Balanced / Turbo and apply default fan curves
2. Switch between Eco / Standard or Ultimate **GPU modes**
3. Change laptop screen refresh rate - 60hz or your maximum (120hz, 144hz, etc depending on the model) with display overdrive (OD)
4. View default fan profiles for every mode and **auto apply** custom ones
5. Control keyboard backlit animation and colors
6. Set battery charge limit to preserve battery health
7. Monitor CPU temperature, fan speeds and battery discharge rate
8. **Automatically switch to Eco(iGPU)/60hz on battery** and back to Standard(GPU)/120hz modes when plugged
9. Support for FN+F5 to cycle through performance modes (with OSD notification) and FN+F4 to cycle through keeyboard animation modes
10. Basic keybindings for M3 and M4 keys
11. Turn cpu turbo boost on/off with one checkbox to keep temps cooler
Designed and developed for Asus Zephyrus G14 2022 (with AMD Radeon iGPU and dGPU). But could and should potentially work for G14 of 2021 and 2020, G15, X FLOW, and other ROG models for relevant and supported features.
To keep autoswitching and hotkeys work app needs to stay in running in tray. It doesn't consume any resources.
## Performance Profile switching
Profiles are **same** as in Armory Crate (as they are stored in bios), including default fan curves
1. Silent (minimal or no fans, 70W PPT total, up to 45W PPT to CPU)
2. Balanced (balanced fans, 100W PPT total, up to 45W PPT to CPU)
3. Turbo (intense fans, 125W PPT total, up to 80W PPT to CPU)
PPTs are shown for G14 2022, for other models PPTs will be different as they are set in bios.
## GPU Modes
1. Eco mode : only low power integrated GPU enabled, iGPU drives built in display
2. Standard mode (Windows Hybrid) : iGPU and dGPU enabled, iGPU drives built in display
3. Ultimate mode: iGPU and dGPU enabled, but dGPU drives built in display (supported only on G14 2022 model)
## How to install
1. Download latest release from [**Releases Page**](https://github.com/seerge/g-helper/releases)
2. Unzip to a folder of your choice
3. Run **GHelper.exe**
App requires [.NET7](https://dotnet.microsoft.com/en-us/download) to be installed. Most probably you already have it. Otherwise you can [download it](https://dotnet.microsoft.com/en-us/download).
I recommend to keep "Asus Optimization Service" running, as it keeps basic laptop hotkeys such as screen or keyboard brightness adjustment working. If you have (or had) MyASUS app installed, that service is most probably still up an running even after MyASUS uninstall. It's part of [Asus System Controll Interface](https://www.asus.com/support/FAQ/1047338/). You can install it, and later disable / remove unnecesarily services by running [this bat file](https://raw.githubusercontent.com/seerge/g-helper/main/stop-asus-sv.bat) as admin.
Note: Uses low level ASUS ACPI commands and doens't require Armory Crate to be installed at all! Doesn't need administrator privileges to run!
I don`t have Microsoft certificate to sign app yet, so if you get a warning from Windows Defender on launch (Windows Protected your PC), click More Info -> Run anyway. Alternatively you can compile and run project by yourself using Visual Studio :)
Settings file is stored at %AppData%\GHelper
P.S.: It's not recommended to use app in combination with Armory Crate, cause they adjust same settings.
------------------
Debloating helps to save your battery and keep laptop a bit cooler
![Helps to save your battery](https://raw.githubusercontent.com/seerge/g-helper/main/screenshots/screen-5w.png)
---------
**Disclaimers**
"ROG", "TUF", and "Armoury Crate" are trademarked by and belong to AsusTek Computer, Inc. I make no claims to these or any assets belonging to AsusTek Computer and use them purely for informational purposes only.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. MISUSE OF THIS SOFTWARE COULD CAUSE SYSTEM INSTABILITY OR MALFUNCTION.

View File

@@ -1,9 +1,6 @@
using GHelper;
using System.Diagnostics;
using System.Management;
using System.Management;
using System.Runtime.InteropServices;
public class ASUSWmi
{
@@ -23,16 +20,21 @@ public class ASUSWmi
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 int PPT_TotalA0 = 0x001200A0;
public const int PPT_TotalA1 = 0x001200A1;
public const int PPT_TotalA0 = 0x001200A0; // Total PPT on 2022 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;
public const int PPT_CPUB1 = 0x001200B1;
public const int PPT_CPUA2 = 0x001200A2;
public const int PPT_CPUB0 = 0x001200B0; // CPU PPT on 2022
public const int PPT_CPUB1 = 0x001200B1; // APU PPT on 2022
public const int PPT_APUC1 = 0x001200C1;
public const int PPT_APUC2 = 0x001200C2;
public const int PerformanceBalanced = 0;
public const int PerformanceTurbo = 1;
@@ -44,11 +46,11 @@ public class ASUSWmi
public const int MaxTotal = 150;
public const int MinTotal = 15;
public const int MinTotal = 5;
public const int DefaultTotal = 125;
public const int MaxCPU = 90;
public const int MinCPU = 15;
public const int MinCPU = 5;
public const int DefaultCPU = 80;
@@ -183,7 +185,7 @@ public class ASUSWmi
if (curve.Length != 16) return;
if (curve.All(singleByte => singleByte == 0)) return;
Logger.WriteLine("Fans" + ((device == 1)?"GPU":"CPU") + " " + BitConverter.ToString(curve));
Logger.WriteLine("Fans" + ((device == 1) ? "GPU" : "CPU") + " " + BitConverter.ToString(curve));
if (device == 1)
DeviceSet(DevsGPUFanCurve, curve);

View File

@@ -4,6 +4,9 @@ using Starlight.Communication;
using System.Diagnostics;
using System.Text;
using System.Management;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
using System.Drawing.Imaging;
using System.Windows.Forms;
namespace Starlight.AnimeMatrix
{
@@ -62,26 +65,25 @@ namespace Starlight.AnimeMatrix
Off = 0,
Dim = 1,
Medium = 2,
Full = 3
Full = 3,
Super = 4, //test, doesn't work
}
public class AnimeMatrixDevice : Device
{
private const int UpdatePageLength = 0x0278;
int UpdatePageLength = 490;
int LedCount = 1450;
public int LedCount => 1450;
private byte[] _displayBuffer = new byte[UpdatePageLength * 3];
private List<byte[]> frames = new List<byte[]>();
private int pages = 3;
byte[] _displayBuffer;
List<byte[]> frames = new List<byte[]>();
public int MaxColumns = 34;
public int MaxRows = 61;
public int FullRows = 11;
public int EmptyFirstRow = 0;
private int frameIndex = 0;
public AnimeMatrixDevice()
@@ -89,14 +91,19 @@ namespace Starlight.AnimeMatrix
{
string model = GetModel();
Debug.WriteLine(model);
if (model is not null && model.Contains("401"))
{
pages = 2;
EmptyFirstRow = 1;
FullRows = 6;
MaxColumns = 33;
MaxRows = 55;
LedCount = 1213;
UpdatePageLength = 410;
}
_displayBuffer = new byte[LedCount];
}
@@ -145,6 +152,7 @@ namespace Starlight.AnimeMatrix
public int EmptyColumns(int row)
{
if (row == 0) return EmptyFirstRow;
return (int)Math.Ceiling(Math.Max(0, row - FullRows) / 2.0);
}
public int Columns(int row)
@@ -159,11 +167,8 @@ namespace Starlight.AnimeMatrix
var ret = 0;
if (row > 0)
{
for (var i = 0; i < row; i++)
ret += Columns(i);
}
for (var i = 0; i < row; i++)
ret += Columns(i);
return ret;
}
@@ -175,13 +180,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)
@@ -198,7 +203,7 @@ namespace Starlight.AnimeMatrix
EnsureRowInRange(y);
var start = RowToLinearAddress(y) - EmptyColumns(y);
if (x > EmptyColumns(y))
if (x >= EmptyColumns(y))
SetLedLinear(start + x, value);
}
@@ -214,26 +219,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,10 +272,15 @@ namespace Starlight.AnimeMatrix
Set(Packet<AnimeMatrixPacket>(0xC5, animation.AsByte));
}
static int GetColor(Bitmap bmp, int x, int y)
{
var pixel = bmp.GetPixel(Math.Max(0,Math.Min(bmp.Width - 1,x)), Math.Max(0, Math.Min(bmp.Height - 1, y)));
return (Math.Max((pixel.R + pixel.G + pixel.B) / 3 - 10, 0));
}
public void GenerateFrame(Image image)
{
int width = MaxColumns * 3;
int width = MaxColumns*3;
int height = MaxRows;
float scale;
@@ -289,17 +296,20 @@ namespace Starlight.AnimeMatrix
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);
graph.DrawImage(image, ((int)width - scaleWidth), 0, scaleWidth, scaleHeight);
Bitmap bmp = new Bitmap(canvas, MaxColumns, MaxRows);
Bitmap bmp = new Bitmap(canvas, MaxColumns * 2, MaxRows);
for (int y = 0; y < bmp.Height; y++)
{
for (int x = 0; x < bmp.Width; x++)
{
var pixel = bmp.GetPixel(x, y);
byte color = (byte)(Math.Max((pixel.R + pixel.G + pixel.B) / 3 - 10, 0));
SetLedPlanar(x, y, color);
if (x % 2 == (y % 2))
{
var color = GetColor(bmp, x, y);
//var color2= GetColor(bmp, x+1, y);
SetLedPlanar(x/2,y, (byte)color);
}
}
}
@@ -313,12 +323,9 @@ namespace Starlight.AnimeMatrix
}
}
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);
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Text.Json;
using System.Management;
using System.Text.Json;
public class AppConfig
{
@@ -6,6 +7,8 @@ public class AppConfig
public string appPath;
string configFile;
string _model;
public Dictionary<string, object> config = new Dictionary<string, object>();
public AppConfig()
@@ -36,6 +39,26 @@ public class AppConfig
}
public bool ContainsModel(string contains)
{
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 is not null && _model.Contains(contains));
}
private void initConfig()
{
config = new Dictionary<string, object>();

View File

@@ -43,7 +43,7 @@ public class Aura
{
HidDevice[] HidDeviceList;
int[] deviceIds = { 0x1854, 0x1869, 0x1866, 0x19b6 };
int[] deviceIds = { 0x1854, 0x1869, 0x1866, 0x19b6, 0x1822, 0x1837, 0x1854, 0x184a, 0x183d, 0x8502, 0x1807, 0x17e0 };
HidDeviceList = HidDevices.Enumerate(0x0b05, deviceIds).ToArray();
@@ -63,18 +63,14 @@ public class Aura
foreach (HidDevice device in HidDeviceList)
{
if (device.IsConnected)
if (device.IsConnected && device.Description.Contains("HID"))
{
if (device.Description.IndexOf("HID") >= 0)
{
device.OpenDevice();
byte[] msg = AuraMessage(Mode, Color1, Color2, Speed);
device.Write(msg);
device.Write(MESSAGE_SET);
device.Write(MESSAGE_APPLY);
device.CloseDevice();
}
device.OpenDevice();
byte[] msg = AuraMessage(Mode, Color1, Color2, Speed);
device.Write(msg);
device.Write(MESSAGE_SET);
device.Write(MESSAGE_APPLY);
device.CloseDevice();
}
}

182
app/ControlHelper.cs Normal file
View File

@@ -0,0 +1,182 @@
using CustomControls;
using System.Drawing.Drawing2D;
using System.Windows.Forms.DataVisualization.Charting;
public static class ControlHelper
{
static bool _invert = false;
static bool _resize = false;
static float _scale = 1;
static Color formBack;
static Color backMain;
static Color foreMain;
static Color foreAccent;
static Color borderMain;
static Color buttonMain;
public static void Adjust(RForm container, bool darkTheme = false, bool invert = false)
{
if (darkTheme)
{
formBack = Color.FromArgb(255, 35, 35, 35);
backMain = Color.FromArgb(255, 50, 50, 50);
foreMain = Color.White;
foreAccent = Color.FromArgb(255, 100, 100, 100);
borderMain = Color.FromArgb(255, 50, 50, 50);
buttonMain = Color.FromArgb(255, 80, 80, 80);
}
else
{
formBack = SystemColors.Control;
backMain = SystemColors.ControlLightLight;
foreMain = SystemColors.ControlText;
foreAccent = Color.LightGray;
borderMain = Color.LightGray;
buttonMain = SystemColors.ControlLight;
}
container.BackColor = formBack;
container.ForeColor = foreMain;
_invert = invert;
AdjustControls(container.Controls);
_invert = false;
}
public static void Resize(RForm container, float baseScale = 2)
{
_scale = GetDpiScale(container).Value / baseScale;
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 ? buttonMain : backMain;
button.ForeColor = foreMain;
button.FlatStyle = FlatStyle.Flat;
button.FlatAppearance.BorderColor = 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 = backMain;
combo.ForeColor = foreMain;
combo.BorderColor = backMain;
combo.ButtonColor = buttonMain;
}
var gb = control as GroupBox;
if (gb != null)
{
gb.ForeColor = foreMain;
}
var chart = control as Chart;
if (chart != null)
{
chart.BackColor = backMain;
chart.ChartAreas[0].BackColor = backMain;
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = foreAccent;
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = foreAccent;
chart.ChartAreas[0].AxisX.TitleForeColor = foreMain;
chart.ChartAreas[0].AxisY.TitleForeColor = foreMain;
chart.ChartAreas[0].AxisX.LabelStyle.ForeColor = foreMain;
chart.ChartAreas[0].AxisY.LabelStyle.ForeColor = foreMain;
chart.ChartAreas[0].AxisX.MajorTickMark.LineColor = foreMain;
chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = foreMain;
chart.ChartAreas[0].AxisX.LineColor = foreAccent;
chart.ChartAreas[0].AxisY.LineColor = foreAccent;
chart.Titles[0].ForeColor = 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;
}
}

338
app/CustomControls.cs Normal file
View File

@@ -0,0 +1,338 @@
using Microsoft.Win32;
using System.ComponentModel;
using System.Drawing.Drawing2D;
using System.Runtime.InteropServices;
namespace CustomControls
{
public class RForm : Form
{
protected static Color colorEco = Color.FromArgb(255, 6, 180, 138);
protected static Color colorStandard = Color.FromArgb(255, 58, 174, 239);
protected static Color colorTurbo = Color.FromArgb(255, 255, 32, 32);
[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;
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 void InitTheme(bool setDPI = true)
{
bool newDarkTheme = IsDarkTheme();
bool changed = (darkTheme != newDarkTheme);
darkTheme = newDarkTheme;
if (setDPI)
ControlHelper.Resize(this);
DwmSetWindowAttribute(this.Handle, 20, new[] { darkTheme ? 1 : 0 }, 4);
ControlHelper.Adjust(this, darkTheme, changed);
}
}
public class RTrackBar : TrackBar
{
}
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.LightGray;
[DefaultValue(typeof(Color), "LightGray")]
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;
private bool activated = false;
private bool secondary = false;
private Color borderColor = Color.Transparent;
public Color BorderColor
{
get { return borderColor; }
set
{
borderColor = value;
}
}
public bool Activated
{
get { return activated; }
set
{
if (activated != value)
this.Invalidate();
activated = value;
}
}
public bool Secondary
{
get { return secondary; }
set
{
secondary = value;
}
}
public RButton()
{
this.FlatStyle = FlatStyle.Flat;
this.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
View File

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

View File

@@ -1,4 +1,7 @@
namespace GHelper
using CustomControls;
using System.Windows.Forms.DataVisualization.Charting;
namespace GHelper
{
partial class Fans
{
@@ -28,24 +31,27 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
ChartArea chartArea1 = new ChartArea();
Title title1 = new Title();
ChartArea chartArea2 = new ChartArea();
Title title2 = new Title();
panelFans = new Panel();
labelTip = new Label();
labelBoost = new Label();
comboBoost = new ComboBox();
comboBoost = new RComboBox();
picturePerf = new PictureBox();
tableFanCharts = new TableLayoutPanel();
chartGPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
chartCPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
chartGPU = new Chart();
chartCPU = new Chart();
labelFans = new Label();
checkAuto = new CheckBox();
buttonReset = new Button();
buttonApply = new Button();
buttonReset = new RButton();
buttonApply = new RButton();
panelPower = new Panel();
pictureBox1 = new PictureBox();
labelPowerLimits = new Label();
checkApplyPower = new CheckBox();
buttonApplyPower = new Button();
buttonApplyPower = new RButton();
panelCPU = new Panel();
labelCPU = new Label();
label2 = new Label();
@@ -73,6 +79,7 @@
//
// panelFans
//
panelFans.Controls.Add(labelTip);
panelFans.Controls.Add(labelBoost);
panelFans.Controls.Add(comboBoost);
panelFans.Controls.Add(picturePerf);
@@ -89,6 +96,17 @@
panelFans.Size = new Size(824, 1159);
panelFans.TabIndex = 12;
//
// labelTip
//
labelTip.AutoSize = true;
labelTip.BackColor = SystemColors.ControlLightLight;
labelTip.Location = new Point(245, 13);
labelTip.Name = "labelTip";
labelTip.Padding = new Padding(5);
labelTip.Size = new Size(107, 42);
labelTip.TabIndex = 40;
labelTip.Text = "500,300";
//
// labelBoost
//
labelBoost.AutoSize = true;
@@ -101,6 +119,7 @@
// comboBoost
//
comboBoost.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
comboBoost.BorderColor = Color.White;
comboBoost.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoost.FormattingEnabled = true;
comboBoost.Items.AddRange(new object[] { "Disabled", "Enabled", "Aggressive", "Efficient Enabled", "Efficient Aggressive" });
@@ -150,6 +169,8 @@
chartGPU.Size = new Size(760, 476);
chartGPU.TabIndex = 17;
chartGPU.Text = "chart1";
title1.Name = "Title1";
chartGPU.Titles.Add(title1);
//
// chartCPU
//
@@ -162,6 +183,8 @@
chartCPU.Size = new Size(760, 476);
chartCPU.TabIndex = 14;
chartCPU.Text = "chartCPU";
title2.Name = "Title1";
chartCPU.Titles.Add(title2);
//
// labelFans
//
@@ -188,25 +211,35 @@
//
// buttonReset
//
buttonReset.Activated = false;
buttonReset.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonReset.BackColor = SystemColors.ControlLight;
buttonReset.BorderColor = Color.Transparent;
buttonReset.FlatStyle = FlatStyle.Flat;
buttonReset.Location = new Point(30, 1081);
buttonReset.Margin = new Padding(4, 2, 4, 2);
buttonReset.Name = "buttonReset";
buttonReset.Secondary = true;
buttonReset.Size = new Size(232, 44);
buttonReset.TabIndex = 15;
buttonReset.Text = "Factory Defaults";
buttonReset.UseVisualStyleBackColor = true;
buttonReset.UseVisualStyleBackColor = false;
//
// buttonApply
//
buttonApply.Activated = false;
buttonApply.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonApply.BackColor = SystemColors.ControlLight;
buttonApply.BorderColor = Color.Transparent;
buttonApply.FlatStyle = FlatStyle.Flat;
buttonApply.Location = new Point(542, 1081);
buttonApply.Margin = new Padding(4, 2, 4, 2);
buttonApply.Name = "buttonApply";
buttonApply.Secondary = true;
buttonApply.Size = new Size(248, 44);
buttonApply.TabIndex = 14;
buttonApply.Text = "Apply Fan Curve";
buttonApply.UseVisualStyleBackColor = true;
buttonApply.UseVisualStyleBackColor = false;
//
// panelPower
//
@@ -264,14 +297,19 @@
//
// buttonApplyPower
//
buttonApplyPower.Activated = false;
buttonApplyPower.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
buttonApplyPower.BackColor = SystemColors.ControlLight;
buttonApplyPower.BorderColor = Color.Transparent;
buttonApplyPower.FlatStyle = FlatStyle.Flat;
buttonApplyPower.Location = new Point(20, 1081);
buttonApplyPower.Margin = new Padding(4, 2, 4, 2);
buttonApplyPower.Name = "buttonApplyPower";
buttonApplyPower.Secondary = true;
buttonApplyPower.Size = new Size(324, 44);
buttonApplyPower.TabIndex = 24;
buttonApplyPower.Text = "Apply Power Limits";
buttonApplyPower.UseVisualStyleBackColor = true;
buttonApplyPower.UseVisualStyleBackColor = false;
//
// panelCPU
//
@@ -443,11 +481,11 @@
#endregion
private Panel panelFans;
private CheckBox checkAuto;
private Button buttonReset;
private Button buttonApply;
private RButton buttonReset;
private RButton buttonApply;
private Panel panelPower;
private CheckBox checkApplyPower;
private Button buttonApplyPower;
private RButton buttonApplyPower;
private Panel panelCPU;
private Label labelCPU;
private Label label2;
@@ -466,7 +504,8 @@
private Label labelFans;
private PictureBox picturePerf;
private PictureBox pictureBox1;
private ComboBox comboBoost;
private RComboBox comboBoost;
private Label labelBoost;
private Label labelTip;
}
}

View File

@@ -1,16 +1,25 @@
using System;
using System.Diagnostics;
using System.Diagnostics;
using System.Windows.Forms.DataVisualization.Charting;
using CustomControls;
namespace GHelper
{
public partial class Fans : Form
public partial class Fans : RForm
{
DataPoint curPoint = null;
Series seriesCPU;
Series seriesGPU;
static int MinRPM, MaxRPM;
static string ChartPercToRPM(int percentage, string unit = "")
{
if (percentage == 0) return "OFF";
return (200 * Math.Round((float)(MinRPM + (MaxRPM - MinRPM) * percentage * 0.01) / 200)).ToString() + unit;
}
void SetChart(Chart chart, int device)
{
@@ -24,13 +33,7 @@ namespace GHelper
if (Program.settingsForm.perfName.Length > 0)
labelFans.Text = "Fan Profiles: " + 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;
@@ -41,10 +44,8 @@ namespace GHelper
chart.ChartAreas[0].AxisY.LabelStyle.Font = new Font("Arial", 7F);
chart.ChartAreas[0].AxisY.CustomLabels.Add(-2, 2, "OFF");
for (int i = 1; i <= 9; i++)
chart.ChartAreas[0].AxisY.CustomLabels.Add(i * 10 - 2, i * 10 + 2, (1800 + 400 * i).ToString());
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");
@@ -76,14 +77,29 @@ namespace GHelper
{
InitializeComponent();
InitTheme();
MinRPM = 1800;
if (Program.config.ContainsModel("401"))
MaxRPM = 7200;
else if (Program.config.ContainsModel("503"))
MaxRPM = 6800;
else
MaxRPM = 5800;
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;
seriesCPU.Color = colorStandard;
seriesGPU.Color = colorTurbo;
chartCPU.MouseMove += ChartCPU_MouseMove;
chartCPU.MouseUp += ChartCPU_MouseUp;
@@ -126,7 +142,7 @@ namespace GHelper
{
int boost = NativeMethods.GetCPUBoost();
if (boost >= 0)
comboBoost.SelectedIndex = boost;
comboBoost.SelectedIndex = Math.Min(boost, comboBoost.Items.Count - 1);
}
private void ComboBoost_Changed(object? sender, EventArgs e)
@@ -168,8 +184,17 @@ namespace GHelper
public void InitPower(bool changed = false)
{
panelPower.Visible = (Program.wmi.DeviceGet(ASUSWmi.PPT_TotalA0) >= 0);
panelCPU.Visible = (Program.wmi.DeviceGet(ASUSWmi.PPT_CPUB0) >= 0);
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;
panelCPU.Visible = cpuBmode;
// Yes, that's stupid, but Total slider on 2021 model actually adjusts CPU PPT
if (!cpuBmode)
{
label1.Text = "CPU SPPT";
}
int limit_total;
int limit_cpu;
@@ -225,12 +250,12 @@ namespace GHelper
{
if (applied)
{
labelApplied.ForeColor = Color.Blue;
labelApplied.ForeColor = colorStandard;
labelApplied.Text = "Applied";
}
else
{
labelApplied.ForeColor = Color.Red;
labelApplied.ForeColor = colorTurbo;
labelApplied.Text = "Not Applied";
}
@@ -325,6 +350,7 @@ namespace GHelper
private void ChartCPU_MouseUp(object? sender, MouseEventArgs e)
{
curPoint = null;
labelTip.Visible = false;
}
private void ChartCPU_MouseMove(object? sender, MouseEventArgs e)
@@ -362,13 +388,18 @@ namespace GHelper
if (dy < 0) dy = 0;
if (dy > 100) dy = 100;
dymin = (dx - 60) * 1.2;
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;
}
catch
{

View File

@@ -16,9 +16,15 @@
<PlatformTarget>x64</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyVersion>0.27</AssemblyVersion>
<AssemblyVersion>0.33</AssemblyVersion>
</PropertyGroup>
<ItemGroup>
<Compile Remove="screenshots\**" />
<EmbeddedResource Remove="screenshots\**" />
<None Remove="screenshots\**" />
</ItemGroup>
<ItemGroup>
<None Remove="Resources\eco.ico" />
<None Remove="Resources\icons8-charging-battery-48.png" />
@@ -32,7 +38,7 @@
<ItemGroup>
<Content Include="favicon.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
@@ -45,15 +51,6 @@
<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>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\eco.ico">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
@@ -102,8 +99,4 @@
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="screenshots\" />
</ItemGroup>
</Project>

View File

@@ -58,28 +58,36 @@ public static class HardwareMonitor
}
public static void RecreateGpuTemperatureProvider() {
try {
try
{
GpuTemperatureProvider?.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) {
if (gpuTemperatureProvider.IsValid)
{
GpuTemperatureProvider = gpuTemperatureProvider;
return;
}
gpuTemperatureProvider.Dispose();
gpuTemperatureProvider = new AmdGpuTemperatureProvider();
if (gpuTemperatureProvider.IsValid) {
if (gpuTemperatureProvider.IsValid)
{
GpuTemperatureProvider = gpuTemperatureProvider;
return;
}
gpuTemperatureProvider.Dispose();
GpuTemperatureProvider = null;
} finally {
}
catch (Exception ex)
{
}
finally
{
Logger.WriteLine($"GpuTemperatureProvider: {GpuTemperatureProvider?.GetType().Name}");
}
}

View File

@@ -1,4 +1,6 @@
namespace GHelper
using CustomControls;
namespace GHelper
{
partial class Keyboard
{
@@ -31,12 +33,12 @@
groupBox1 = new GroupBox();
textM4 = new TextBox();
textM3 = new TextBox();
comboM4 = new ComboBox();
comboM4 = new RComboBox();
labelM4 = new Label();
comboM3 = new ComboBox();
comboM3 = new RComboBox();
labelM3 = new Label();
textFNF4 = new TextBox();
comboFNF4 = new ComboBox();
comboFNF4 = new RComboBox();
labelFNF4 = new Label();
groupBox1.SuspendLayout();
SuspendLayout();
@@ -161,13 +163,13 @@
private GroupBox groupBox1;
private Label labelM3;
private ComboBox comboM3;
private ComboBox comboM4;
private RComboBox comboM3;
private RComboBox comboM4;
private Label labelM4;
private TextBox textM4;
private TextBox textM3;
private TextBox textFNF4;
private ComboBox comboFNF4;
private RComboBox comboFNF4;
private Label labelFNF4;
}
}

View File

@@ -1,6 +1,8 @@
namespace GHelper
using CustomControls;
namespace GHelper
{
public partial class Keyboard : Form
public partial class Keyboard : RForm
{
Dictionary<string, string> customActions = new Dictionary<string, string>
@@ -51,6 +53,7 @@
public Keyboard()
{
InitializeComponent();
InitTheme();
SetKeyCombo(comboM3, textM3, "m3");
SetKeyCombo(comboM4, textM4, "m4");

39
app/Logger.cs Normal file
View File

@@ -0,0 +1,39 @@
using System.Diagnostics;
public static class Logger
{
static string appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
static string logFile = appPath + "\\log.txt";
public static void WriteLine(string logMessage)
{
Debug.WriteLine(logMessage);
if (!Directory.Exists(appPath)) Directory.CreateDirectory(appPath);
try
{
using (StreamWriter w = File.AppendText(logFile))
{
w.WriteLine($"{DateTime.Now}: {logMessage}");
w.Close();
}
}
catch { }
if (new Random().Next(100) == 1) Cleanup();
}
public static void Cleanup()
{
try
{
var file = File.ReadAllLines(logFile);
int skip = Math.Max(0, file.Count() - 500);
File.WriteAllLines(logFile, file.Skip(skip).ToArray());
}
catch { }
}
}

View File

@@ -1,10 +1,7 @@
using System.Collections;
using System;
using System.ComponentModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.InteropServices;
using static Tools.ScreenInterrogatory;
using System.Windows.Forms;
namespace Tools
{
@@ -458,6 +455,15 @@ public class NativeMethods
static readonly Guid GUID_CPU = new Guid("54533251-82be-4824-96c1-47b60b740d00");
static readonly Guid GUID_BOOST = new Guid("be337238-0d82-4146-a960-4f3749d470c7");
[DllImportAttribute("powrprof.dll", EntryPoint = "PowerGetActualOverlayScheme")]
public static extern uint PowerGetActualOverlayScheme(out Guid ActualOverlayGuid);
[DllImportAttribute("powrprof.dll", EntryPoint = "PowerGetEffectiveOverlayScheme")]
public static extern uint PowerGetEffectiveOverlayScheme(out Guid EffectiveOverlayGuid);
[DllImportAttribute("powrprof.dll", EntryPoint = "PowerSetActiveOverlayScheme")]
public static extern uint PowerSetActiveOverlayScheme(Guid OverlaySchemeGuid);
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct DEVMODE
{
@@ -666,4 +672,20 @@ public class NativeMethods
*/
}
public static void SetPowerScheme(int mode)
{
switch (mode)
{
case 0: // balanced
PowerSetActiveOverlayScheme(new Guid("00000000-0000-0000-0000-000000000000"));
break;
case 1: // turbo
PowerSetActiveOverlayScheme(new Guid("ded574b5-45a0-4f42-8737-46345c09c238"));
break;
case 2: //silent
PowerSetActiveOverlayScheme(new Guid("961cc777-2547-4f9d-8174-7d86181b8a7a"));
break;
}
}
}

View File

@@ -2,43 +2,7 @@ using Microsoft.Win32;
using System.Diagnostics;
using System.Management;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text.Json;
public static class Logger
{
static string appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
static string logFile = appPath + "\\log.txt";
public static void WriteLine(string logMessage)
{
Debug.WriteLine(logMessage);
if (!Directory.Exists(appPath)) Directory.CreateDirectory(appPath);
try
{
using (StreamWriter w = File.AppendText(logFile))
{
w.WriteLine($"{DateTime.Now}: {logMessage}");
w.Close();
}
} catch
{
}
if (new Random().Next(100) == 1) Cleanup();
}
public static void Cleanup()
{
var file = File.ReadAllLines(logFile);
int skip = Math.Max(0, file.Count() - 500);
File.WriteAllLines(logFile,file.Skip(skip).ToArray());
}
}
namespace GHelper
{
@@ -46,31 +10,6 @@ namespace GHelper
{
// Native methods for sleep detection
[DllImport("Powrprof.dll", SetLastError = true)]
static extern uint PowerRegisterSuspendResumeNotification(uint flags, ref DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS receipient, ref IntPtr registrationHandle);
private const int WM_POWERBROADCAST = 536; // (0x218)
private const int PBT_APMPOWERSTATUSCHANGE = 10; // (0xA) - Power status has changed.
private const int PBT_APMRESUMEAUTOMATIC = 18; // (0x12) - Operation is resuming automatically from a low-power state.This message is sent every time the system resumes.
private const int PBT_APMRESUMESUSPEND = 7; // (0x7) - Operation is resuming from a low-power state.This message is sent after PBT_APMRESUMEAUTOMATIC if the resume is triggered by user input, such as pressing a key.
private const int PBT_APMSUSPEND = 4; // (0x4) - System is suspending operation.
private const int PBT_POWERSETTINGCHANGE = 32787; // (0x8013) - A power setting change event has been received.
private const int DEVICE_NOTIFY_CALLBACK = 2;
[StructLayout(LayoutKind.Sequential)]
struct DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS
{
public DeviceNotifyCallbackRoutine Callback;
public IntPtr Context;
}
public delegate int DeviceNotifyCallbackRoutine(IntPtr context, int type, IntPtr setting);
//
public static NotifyIcon trayIcon = new NotifyIcon
{
Text = "G-Helper",
@@ -88,6 +27,7 @@ namespace GHelper
private static IntPtr ds;
private static long lastAuto;
private static long lastTheme;
// The main entry point for the application
public static void Main()
@@ -109,6 +49,9 @@ namespace GHelper
}
SystemEvents.UserPreferenceChanged += new
UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged);
Application.EnableVisualStyles();
ds = settingsForm.Handle;
@@ -121,27 +64,11 @@ namespace GHelper
settingsForm.InitAura();
settingsForm.InitMatrix();
settingsForm.VisualiseGPUAuto(config.getConfig("gpu_auto"));
settingsForm.VisualiseScreenAuto(config.getConfig("screen_auto"));
settingsForm.SetStartupCheck(Startup.IsScheduled());
SetAutoModes();
HardwareMonitor.RecreateGpuTemperatureProvider();
// Subscribing for native power change events
/*
IntPtr registrationHandle = new IntPtr();
DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS recipient = new DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS();
recipient.Callback = new DeviceNotifyCallbackRoutine(DeviceNotifyCallback);
recipient.Context = IntPtr.Zero;
IntPtr pRecipient = Marshal.AllocHGlobal(Marshal.SizeOf(recipient));
Marshal.StructureToPtr(recipient, pRecipient, false);
uint result = PowerRegisterSuspendResumeNotification(DEVICE_NOTIFY_CALLBACK, ref recipient, ref registrationHandle);
*/
// Subscribing for monitor power on events
var settingGuid = new NativeMethods.PowerSettingGuid();
unRegPowerNotify = NativeMethods.RegisterPowerSettingNotification(ds, settingGuid.ConsoleDisplayState, NativeMethods.DEVICE_NOTIFY_WINDOW_HANDLE);
@@ -149,26 +76,33 @@ namespace GHelper
// Subscribing for system power change events
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
CheckForUpdates();
Application.Run();
}
private static int DeviceNotifyCallback(IntPtr context, int type, IntPtr setting)
static void SystemEvents_UserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
{
Logger.WriteLine($"Power callback {type}");
switch (type)
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastTheme) < 2000) return;
lastTheme = DateTimeOffset.Now.ToUnixTimeMilliseconds();
switch (e.Category)
{
case PBT_APMRESUMEAUTOMATIC:
settingsForm.BeginInvoke(delegate
{
SetAutoModes();
});
case UserPreferenceCategory.General:
Debug.WriteLine("Theme Changed");
Thread.Sleep(500);
settingsForm.InitTheme(false);
if (settingsForm.fans is not null && settingsForm.fans.Text != "")
settingsForm.fans.InitTheme(false);
if (settingsForm.keyb is not null && settingsForm.keyb.Text != "")
settingsForm.keyb.InitTheme(false);
break;
}
return 0;
}
@@ -207,7 +141,7 @@ namespace GHelper
}
public static void SetAutoModes()
public static void SetAutoModes(bool wait = false)
{
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastAuto) < 1000) return;
@@ -220,7 +154,10 @@ namespace GHelper
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
settingsForm.AutoPerformance(isPlugged);
// waiting a bit before turning off dGPU
// if (wait && isPlugged != PowerLineStatus.Online) Thread.Sleep(3000);
bool switched = settingsForm.AutoGPUMode(isPlugged);
if (!switched) settingsForm.AutoScreen(isPlugged);
@@ -230,7 +167,7 @@ namespace GHelper
private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
{
Logger.WriteLine("Windows - Power Mode Changed");
SetAutoModes();
SetAutoModes(true);
}

View File

@@ -80,6 +80,26 @@ namespace GHelper.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_balance_symbol_96 {
get {
object obj = ResourceManager.GetObject("icons8-balance-symbol-96", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_bicycle_48__1_ {
get {
object obj = ResourceManager.GetObject("icons8-bicycle-48 (1)", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@@ -90,6 +110,16 @@ namespace GHelper.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_fan_48 {
get {
object obj = ResourceManager.GetObject("icons8-fan-48", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@@ -100,6 +130,36 @@ namespace GHelper.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_fan_speed_48 {
get {
object obj = ResourceManager.GetObject("icons8-fan-speed-48", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_fiat_500_48 {
get {
object obj = ResourceManager.GetObject("icons8-fiat-500-48", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_game_controller_48 {
get {
object obj = ResourceManager.GetObject("icons8-game-controller-48", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@@ -120,6 +180,36 @@ namespace GHelper.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_launch_96 {
get {
object obj = ResourceManager.GetObject("icons8-launch-96", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_leaf_48 {
get {
object obj = ResourceManager.GetObject("icons8-leaf-48", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_leaf_96 {
get {
object obj = ResourceManager.GetObject("icons8-leaf-96", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@@ -130,6 +220,26 @@ namespace GHelper.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_organic_food_96 {
get {
object obj = ResourceManager.GetObject("icons8-organic-food-96", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_organic_food_961 {
get {
object obj = ResourceManager.GetObject("icons8-organic-food-961", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@@ -140,6 +250,56 @@ namespace GHelper.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_project_management_48 {
get {
object obj = ResourceManager.GetObject("icons8-project-management-48", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_project_management_48__1_ {
get {
object obj = ResourceManager.GetObject("icons8-project-management-48 (1)", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_rocket_48 {
get {
object obj = ResourceManager.GetObject("icons8-rocket-48", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_spa_flower_48 {
get {
object obj = ResourceManager.GetObject("icons8-spa-flower-48", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_spa_flower_96 {
get {
object obj = ResourceManager.GetObject("icons8-spa-flower-96", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@@ -170,6 +330,16 @@ namespace GHelper.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_xbox_controller_96 {
get {
object obj = ResourceManager.GetObject("icons8-xbox-controller-96", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>

View File

@@ -118,43 +118,94 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="eco" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\eco.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="icons8-leaf-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-leaf-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-matrix-desktop-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-matrix-desktop-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="icons8-launch-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-launch-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-charging-battery-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-charging-battery-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-organic-food-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-organic-food-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-fiat-500-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-fiat-500-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-video-card-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-video-card-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-project-management-48 (1)" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-project-management-48 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-bicycle-48 (1)" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-bicycle-48 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-fan-head-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-fan-head-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-processor-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-processor-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-spa-flower-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-spa-flower-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-spa-flower-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-spa-flower-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="standard" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-keyboard-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-keyboard-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-fan-speed-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-fan-speed-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-speed-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-speed-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="eco" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\eco.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-laptop-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-laptop-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-rocket-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-rocket-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-organic-food-961" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-organic-food-961.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-balance-symbol-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-balance-symbol-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-fan-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-fan-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-matrix-desktop-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-matrix-desktop-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-xbox-controller-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-xbox-controller-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-project-management-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-project-management-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-leaf-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-leaf-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ultimate" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ultimate.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="standard" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-speed-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-speed-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="everything-is-fine-itsfine" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\everything-is-fine-itsfine.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-speed-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-speed-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-video-card-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-video-card-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-fan-head-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-fan-head-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-charging-battery-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-charging-battery-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-laptop-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-laptop-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-processor-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-processor-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="icons8-game-controller-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-game-controller-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -0,0 +1,7 @@
{
"profiles": {
"GHelper": {
"commandName": "Project"
}
}
}

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

Before

Width:  |  Height:  |  Size: 220 KiB

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 710 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 B

View File

Before

Width:  |  Height:  |  Size: 421 B

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 B

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 870 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 784 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

View File

Before

Width:  |  Height:  |  Size: 515 B

After

Width:  |  Height:  |  Size: 515 B

View File

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 851 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

View File

Before

Width:  |  Height:  |  Size: 428 B

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 710 B

After

Width:  |  Height:  |  Size: 710 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 837 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 763 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 949 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 954 B

View File

Before

Width:  |  Height:  |  Size: 885 B

After

Width:  |  Height:  |  Size: 885 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 400 B

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -1,22 +1,15 @@
using Starlight.AnimeMatrix;
using CustomControls;
using Starlight.AnimeMatrix;
using System.Diagnostics;
using System.Drawing.Imaging;
using System.Timers;
namespace GHelper
{
public partial class SettingsForm : Form
public partial class SettingsForm : RForm
{
static Color colorEco = Color.FromArgb(255, 6, 180, 138);
static Color colorStandard = Color.FromArgb(255, 58, 174, 239);
static Color colorTurbo = Color.FromArgb(255, 255, 32, 32);
static int buttonInactive = 0;
static int buttonActive = 5;
static System.Timers.Timer aTimer = default!;
static System.Timers.Timer matrixTimer = default!;
@@ -24,26 +17,33 @@ namespace GHelper
public string perfName = "Balanced";
Fans fans;
Keyboard keyb;
public Fans fans;
public Keyboard keyb;
static AnimeMatrixDevice mat;
public SettingsForm()
{
InitializeComponent();
InitTheme();
FormClosing += SettingsForm_FormClosing;
buttonSilent.FlatAppearance.BorderColor = colorEco;
buttonBalanced.FlatAppearance.BorderColor = colorStandard;
buttonTurbo.FlatAppearance.BorderColor = colorTurbo;
buttonSilent.BorderColor = colorEco;
buttonBalanced.BorderColor = colorStandard;
buttonTurbo.BorderColor = colorTurbo;
buttonEco.FlatAppearance.BorderColor = colorEco;
buttonStandard.FlatAppearance.BorderColor = colorStandard;
buttonUltimate.FlatAppearance.BorderColor = colorTurbo;
buttonEco.BorderColor = colorEco;
buttonStandard.BorderColor = colorStandard;
buttonUltimate.BorderColor = colorTurbo;
buttonOptimized.BorderColor = colorEco;
button60Hz.BorderColor = SystemColors.ActiveBorder;
button120Hz.BorderColor = SystemColors.ActiveBorder;
buttonScreenAuto.BorderColor = SystemColors.ActiveBorder;
buttonMiniled.BorderColor = colorTurbo;
buttonOptimized.Click += ButtonOptimized_Click;
buttonSilent.Click += ButtonSilent_Click;
buttonBalanced.Click += ButtonBalanced_Click;
buttonTurbo.Click += ButtonTurbo_Click;
@@ -58,13 +58,11 @@ namespace GHelper
button60Hz.Click += Button60Hz_Click;
button120Hz.Click += Button120Hz_Click;
buttonScreenAuto.Click += ButtonScreenAuto_Click;
buttonMiniled.Click += ButtonMiniled_Click;
buttonQuit.Click += ButtonQuit_Click;
checkGPU.CheckedChanged += CheckGPU_CheckedChanged;
checkScreen.CheckedChanged += checkScreen_CheckedChanged;
comboKeyboard.DropDownStyle = ComboBoxStyle.DropDownList;
comboKeyboard.SelectedIndex = 0;
comboKeyboard.SelectedValueChanged += ComboKeyboard_SelectedValueChanged;
@@ -93,12 +91,96 @@ namespace GHelper
checkStartup.CheckedChanged += CheckStartup_CheckedChanged;
labelVersion.Click += LabelVersion_Click;
labelVersion.ForeColor = Color.FromArgb(128, Color.Gray);
buttonOptimized.MouseMove += ButtonOptimized_MouseHover;
buttonOptimized.MouseLeave += ButtonGPU_MouseLeave;
buttonEco.MouseMove += ButtonEco_MouseHover;
buttonEco.MouseLeave += ButtonGPU_MouseLeave;
buttonStandard.MouseMove += ButtonStandard_MouseHover;
buttonStandard.MouseLeave += ButtonGPU_MouseLeave;
buttonUltimate.MouseMove += ButtonUltimate_MouseHover;
buttonUltimate.MouseLeave += ButtonGPU_MouseLeave;
buttonScreenAuto.MouseMove += ButtonScreenAuto_MouseHover;
buttonScreenAuto.MouseLeave += ButtonScreen_MouseLeave;
button60Hz.MouseMove += Button60Hz_MouseHover;
button60Hz.MouseLeave += ButtonScreen_MouseLeave;
button120Hz.MouseMove += Button120Hz_MouseHover;
button120Hz.MouseLeave += ButtonScreen_MouseLeave;
//buttonStandard.Image = (Image)(new Bitmap(buttonStandard.Image, new Size(16, 16)));
SetTimer();
}
private void Button120Hz_MouseHover(object? sender, EventArgs e)
{
labelTipScreen.Text = "Max refresh rate + screen overdrive for lower latency";
}
private void Button60Hz_MouseHover(object? sender, EventArgs e)
{
labelTipScreen.Text = "60Hz refresh rate to save battery";
}
private void ButtonScreen_MouseLeave(object? sender, EventArgs e)
{
labelTipScreen.Text = "";
}
private void ButtonScreenAuto_MouseHover(object? sender, EventArgs e)
{
labelTipScreen.Text = "Sets 60Hz to save battery, and back when plugged";
}
private void ButtonUltimate_MouseHover(object? sender, EventArgs e)
{
labelTipGPU.Text = "Routes laptop screen to dGPU, maximizing FPS";
}
private void ButtonStandard_MouseHover(object? sender, EventArgs e)
{
labelTipGPU.Text = "Enables dGPU for standard use";
}
private void ButtonEco_MouseHover(object? sender, EventArgs e)
{
labelTipGPU.Text = "Disables dGPU for battery savings";
}
private void ButtonOptimized_MouseHover(object? sender, EventArgs e)
{
labelTipGPU.Text = "Switch to Eco on battery and to Standard when plugged";
}
private void ButtonGPU_MouseLeave(object? sender, EventArgs e)
{
labelTipGPU.Text = "";
}
private void ButtonOptimized_Click(object? sender, EventArgs e)
{
Program.config.setConfig("gpu_auto", (Program.config.getConfig("gpu_auto") == 1) ? 0 : 1);
VisualiseGPUMode();
AutoGPUMode(SystemInformation.PowerStatus.PowerLineStatus);
}
private void ButtonScreenAuto_Click(object? sender, EventArgs e)
{
Program.config.setConfig("screen_auto", 1);
InitScreen();
AutoScreen(SystemInformation.PowerStatus.PowerLineStatus);
}
protected override void WndProc(ref Message m)
{
switch (m.Msg)
@@ -130,12 +212,6 @@ namespace GHelper
base.WndProc(ref m);
}
private void CheckGPU_CheckedChanged(object? sender, EventArgs e)
{
if (sender is null) return;
CheckBox check = (CheckBox)sender;
Program.config.setConfig("gpu_auto", check.Checked ? 1 : 0);
}
public void SetVersionLabel(string label, string url = null)
{
@@ -456,8 +532,8 @@ namespace GHelper
int brightness = Program.config.getConfig("matrix_brightness");
int running = Program.config.getConfig("matrix_running");
comboMatrix.SelectedIndex = (brightness != -1) ? brightness : 0;
comboMatrixRunning.SelectedIndex = (running != -1) ? running : 0;
comboMatrix.SelectedIndex = (brightness != -1) ? Math.Min(brightness, comboMatrix.Items.Count-1) : 0;
comboMatrixRunning.SelectedIndex = (running != -1) ? Math.Min(running, comboMatrixRunning.Items.Count - 1) : 0;
checkMatrix.Checked = (Program.config.getConfig("matrix_auto") == 1);
@@ -528,21 +604,27 @@ namespace GHelper
private void Button120Hz_Click(object? sender, EventArgs e)
{
Program.config.setConfig("screen_auto", 0);
SetScreen(1000, 1);
}
private void Button60Hz_Click(object? sender, EventArgs e)
{
Program.config.setConfig("screen_auto", 0);
SetScreen(60, 0);
}
private void ButtonMiniled_Click(object? sender, EventArgs e)
{
int miniled = (Program.config.getConfig("miniled") == 1) ? 0 : 1;
Program.config.setConfig("miniled", miniled);
SetScreen(-1, -1, miniled);
}
public void SetScreen(int frequency = -1, int overdrive = -1)
public void SetScreen(int frequency = -1, int overdrive = -1, int miniled = -1)
{
int currentFrequency = NativeMethods.GetRefreshRate();
if (currentFrequency < 0) // Laptop screen not detected or has unknown refresh rate
if (NativeMethods.GetRefreshRate() < 0) // Laptop screen not detected or has unknown refresh rate
{
InitScreen();
return;
@@ -551,18 +633,25 @@ namespace GHelper
if (frequency >= 1000)
{
frequency = Program.config.getConfig("max_frequency");
if (frequency <= 60)
frequency = 120;
if (frequency <= 60) frequency = 120;
}
if (frequency <= 0) return;
if (frequency > 0)
{
NativeMethods.SetRefreshRate(frequency);
Logger.WriteLine("Screen " + frequency.ToString() + "Hz");
}
NativeMethods.SetRefreshRate(frequency);
if (overdrive > 0)
if (overdrive >= 0)
Program.wmi.DeviceSet(ASUSWmi.ScreenOverdrive, overdrive);
if (miniled >= 0)
{
Program.wmi.DeviceSet(ASUSWmi.ScreenMiniled, miniled);
Debug.WriteLine("Miniled " + miniled);
}
InitScreen();
Logger.WriteLine("Screen " + frequency.ToString() + "Hz");
}
@@ -572,39 +661,33 @@ namespace GHelper
int frequency = NativeMethods.GetRefreshRate();
int maxFrequency = Program.config.getConfig("max_frequency");
if (frequency < 0)
{
button60Hz.Enabled = false;
button120Hz.Enabled = false;
labelSreen.Text = "Laptop Screen: Turned off";
button60Hz.BackColor = SystemColors.ControlLight;
button120Hz.BackColor = SystemColors.ControlLight;
}
else
{
button60Hz.Enabled = true;
button120Hz.Enabled = true;
button60Hz.BackColor = SystemColors.ControlLightLight;
button120Hz.BackColor = SystemColors.ControlLightLight;
labelSreen.Text = "Laptop Screen";
}
bool screenAuto = (Program.config.getConfig("screen_auto") == 1);
int overdrive = 0;
try
{
overdrive = Program.wmi.DeviceGet(ASUSWmi.ScreenOverdrive);
}
catch
{
Logger.WriteLine("Screen Overdrive not supported");
}
int overdrive = Program.wmi.DeviceGet(ASUSWmi.ScreenOverdrive);
int miniled = Program.wmi.DeviceGet(ASUSWmi.ScreenMiniled);
button60Hz.FlatAppearance.BorderSize = buttonInactive;
button120Hz.FlatAppearance.BorderSize = buttonInactive;
bool screenEnabled = (frequency >= 0);
if (frequency == 60)
ButtonEnabled(button60Hz, screenEnabled);
ButtonEnabled(button120Hz, screenEnabled);
ButtonEnabled(buttonScreenAuto, screenEnabled);
ButtonEnabled(buttonMiniled, screenEnabled);
labelSreen.Text = screenEnabled
? "Laptop Screen: " + frequency + "Hz" + ((overdrive == 1) ? " + Overdrive" : "")
: "Laptop Screen: Turned off";
button60Hz.Activated = false;
button120Hz.Activated = false;
buttonScreenAuto.Activated = false;
if (screenAuto)
{
button60Hz.FlatAppearance.BorderSize = buttonActive;
buttonScreenAuto.Activated = true;
}
else if (frequency == 60)
{
button60Hz.Activated = true;
}
else
{
@@ -612,7 +695,7 @@ namespace GHelper
maxFrequency = frequency;
Program.config.setConfig("max_frequency", maxFrequency);
button120Hz.FlatAppearance.BorderSize = buttonActive;
button120Hz.Activated = true;
}
if (maxFrequency > 60)
@@ -620,6 +703,15 @@ namespace GHelper
button120Hz.Text = maxFrequency.ToString() + "Hz + OD";
}
if (miniled >= 0)
{
buttonMiniled.Activated = (miniled == 1);
Program.config.setConfig("miniled", miniled);
} else
{
buttonMiniled.Visible = false;
}
Program.config.setConfig("frequency", frequency);
Program.config.setConfig("overdrive", overdrive);
}
@@ -741,9 +833,11 @@ namespace GHelper
if (limit_cpu > ASUSWmi.MaxCPU) return;
if (limit_cpu < ASUSWmi.MinCPU) return;
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA0, limit_total);
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA1, limit_total);
Program.wmi.DeviceSet(ASUSWmi.PPT_CPUB0, limit_cpu);
if (Program.wmi.DeviceGet(ASUSWmi.PPT_TotalA0) >= 0)
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA0, limit_total);
if (Program.wmi.DeviceGet(ASUSWmi.PPT_CPUB0) >= 0)
Program.wmi.DeviceSet(ASUSWmi.PPT_CPUB0, limit_cpu);
Logger.WriteLine("PowerLimits " + limit_total.ToString() + ", " + limit_cpu.ToString());
@@ -777,22 +871,23 @@ namespace GHelper
public void SetPerformanceMode(int PerformanceMode = ASUSWmi.PerformanceBalanced, bool notify = false)
{
buttonSilent.FlatAppearance.BorderSize = buttonInactive;
buttonBalanced.FlatAppearance.BorderSize = buttonInactive;
buttonTurbo.FlatAppearance.BorderSize = buttonInactive;
buttonSilent.Activated = false;
buttonBalanced.Activated = false;
buttonTurbo.Activated = false;
switch (PerformanceMode)
{
case ASUSWmi.PerformanceSilent:
buttonSilent.FlatAppearance.BorderSize = buttonActive;
buttonSilent.Activated = true;
perfName = "Silent";
break;
case ASUSWmi.PerformanceTurbo:
buttonTurbo.FlatAppearance.BorderSize = buttonActive;
buttonTurbo.Activated = true;
perfName = "Turbo";
break;
default:
buttonBalanced.FlatAppearance.BorderSize = buttonActive;
buttonBalanced.Activated = true;
PerformanceMode = ASUSWmi.PerformanceBalanced;
perfName = "Balanced";
break;
@@ -819,6 +914,13 @@ namespace GHelper
AutoFansAndPower();
NativeMethods.SetPowerScheme(PerformanceMode);
if (NativeMethods.PowerGetEffectiveOverlayScheme(out Guid activeScheme) == 0)
{
Debug.WriteLine("Effective :" + activeScheme);
}
if (fans != null && fans.Text != "")
{
fans.InitFans();
@@ -847,8 +949,7 @@ namespace GHelper
public void AutoScreen(PowerLineStatus Plugged = PowerLineStatus.Online)
{
int ScreenAuto = Program.config.getConfig("screen_auto");
if (ScreenAuto != 1) return;
if (Program.config.getConfig("screen_auto") != 1) return;
if (Plugged == PowerLineStatus.Online)
SetScreen(1000, 1);
@@ -861,8 +962,8 @@ namespace GHelper
public bool AutoGPUMode(PowerLineStatus Plugged = PowerLineStatus.Online)
{
int GpuAuto = Program.config.getConfig("gpu_auto");
if (GpuAuto != 1) return false;
bool GpuAuto = Program.config.getConfig("gpu_auto") == 1;
if (!GpuAuto) return false;
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
@@ -887,6 +988,29 @@ namespace GHelper
}
private void UltimateUI(bool ultimate)
{
if (!ultimate)
{
tableGPU.Controls.Remove(buttonUltimate);
/*
* buttonFans.Image = null;
buttonFans.Height = 44;
*/
tablePerf.ColumnCount = 0;
tableGPU.ColumnCount = 0;
tableScreen.ColumnCount = 0;
}
tableLayoutKeyboard.ColumnCount = 0;
tableLayoutMatrix.ColumnCount = 0;
}
public int InitGPUMode()
{
@@ -904,14 +1028,17 @@ namespace GHelper
else
GpuMode = ASUSWmi.GPUModeStandard;
buttonUltimate.Visible = (mux == 1);
UltimateUI(mux == 1);
}
Program.config.setConfig("gpu_mode", GpuMode);
ButtonEnabled(buttonOptimized, true);
ButtonEnabled(buttonEco, true);
ButtonEnabled(buttonStandard, true);
ButtonEnabled(buttonUltimate, true);
Program.config.setConfig("gpu_mode", GpuMode);
VisualiseGPUMode(GpuMode);
return GpuMode;
@@ -922,6 +1049,7 @@ namespace GHelper
public void SetEcoGPU(int eco)
{
ButtonEnabled(buttonOptimized, false);
ButtonEnabled(buttonEco, false);
ButtonEnabled(buttonStandard, false);
ButtonEnabled(buttonUltimate, false);
@@ -931,6 +1059,14 @@ namespace GHelper
new Thread(() =>
{
Thread.CurrentThread.IsBackground = true;
if (eco == 1)
{
string[] tokill = { "EADesktop", "RadeonSoftware" };
foreach (string kill in tokill)
foreach (var process in Process.GetProcessesByName(kill)) process.Kill();
}
Program.wmi.DeviceSet(ASUSWmi.GPUEco, eco);
Program.settingsForm.BeginInvoke(delegate
{
@@ -939,7 +1075,10 @@ namespace GHelper
Thread.Sleep(500);
AutoScreen(SystemInformation.PowerStatus.PowerLineStatus);
});
}).Start();
})
{
}.Start();
}
@@ -947,9 +1086,13 @@ namespace GHelper
{
int CurrentGPU = Program.config.getConfig("gpu_mode");
Program.config.setConfig("gpu_auto", 0);
if (CurrentGPU == GPUMode)
{
VisualiseGPUMode();
return;
}
var restart = false;
var changed = false;
@@ -966,7 +1109,7 @@ namespace GHelper
}
else if (GPUMode == ASUSWmi.GPUModeUltimate)
{
DialogResult dialogResult = MessageBox.Show(" Ultimate Mode requires restart", "Reboot now?", MessageBoxButtons.YesNo);
DialogResult dialogResult = MessageBox.Show("Ultimate Mode requires restart", "Reboot now?", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
Program.wmi.DeviceSet(ASUSWmi.GPUMux, 0);
@@ -991,60 +1134,55 @@ namespace GHelper
if (changed)
{
Program.config.setConfig("gpu_mode", GPUMode);
HardwareMonitor.RecreateGpuTemperatureProviderWithRetry();
}
if (restart)
{
VisualiseGPUMode(GPUMode);
VisualiseGPUMode();
Process.Start("shutdown", "/r /t 1");
}
}
public void VisualiseGPUAuto(int GPUAuto)
{
checkGPU.Checked = (GPUAuto == 1);
}
public void VisualiseScreenAuto(int ScreenAuto)
{
checkScreen.Checked = (ScreenAuto == 1);
}
public void VisualiseGPUMode(int GPUMode = -1)
{
if (GPUMode == -1)
{
GPUMode = Program.config.getConfig("gpu_mode");
}
buttonEco.FlatAppearance.BorderSize = buttonInactive;
buttonStandard.FlatAppearance.BorderSize = buttonInactive;
buttonUltimate.FlatAppearance.BorderSize = buttonInactive;
bool GPUAuto = (Program.config.getConfig("gpu_auto") == 1);
buttonEco.Activated = false;
buttonStandard.Activated = false;
buttonUltimate.Activated = false;
buttonOptimized.Activated = false;
switch (GPUMode)
{
case ASUSWmi.GPUModeEco:
buttonEco.FlatAppearance.BorderSize = buttonActive;
buttonOptimized.BorderColor = colorEco;
buttonEco.Activated = !GPUAuto;
buttonOptimized.Activated = GPUAuto;
labelGPU.Text = "GPU Mode: iGPU only";
Program.trayIcon.Icon = GHelper.Properties.Resources.eco;
Program.trayIcon.Icon = Properties.Resources.eco;
break;
case ASUSWmi.GPUModeUltimate:
buttonUltimate.FlatAppearance.BorderSize = buttonActive;
buttonUltimate.Activated = true;
labelGPU.Text = "GPU Mode: dGPU exclusive";
Program.trayIcon.Icon = GHelper.Properties.Resources.ultimate;
Program.trayIcon.Icon = Properties.Resources.ultimate;
break;
default:
buttonStandard.FlatAppearance.BorderSize = buttonActive;
buttonOptimized.BorderColor = colorStandard;
buttonStandard.Activated = !GPUAuto;
buttonOptimized.Activated = GPUAuto;
labelGPU.Text = "GPU Mode: iGPU + dGPU";
Program.trayIcon.Icon = GHelper.Properties.Resources.standard;
Program.trayIcon.Icon = Properties.Resources.standard;
break;
}
}
@@ -1068,10 +1206,10 @@ namespace GHelper
}
public void ButtonEnabled(Button but, bool enabled)
public void ButtonEnabled(RButton but, bool enabled)
{
but.Enabled = enabled;
but.BackColor = enabled ? SystemColors.ControlLightLight : SystemColors.ControlLight;
but.BackColor = but.Enabled ? Color.FromArgb(255, but.BackColor) : Color.FromArgb(100, but.BackColor);
}
public void SetStartupCheck(bool status)
@@ -1102,14 +1240,6 @@ namespace GHelper
}
private void checkScreen_CheckedChanged(object? sender, EventArgs e)
{
if (sender is null) return;
CheckBox check = (CheckBox)sender;
Program.config.setConfig("screen_auto", check.Checked ? 1 : 0);
}
}

View File

@@ -54,8 +54,8 @@
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<!--<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor/dpiAwareness>-->
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">System</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>

View File

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

@@ -5,6 +5,7 @@ sc STOP ASUSSoftwareManager
sc STOP ASUSSwitch
sc STOP ASUSSystemAnalysis
sc STOP ASUSSystemDiagnosis
sc STOP ArmouryCrateControlInterface
sc DELETE AsusAppService
sc DELETE ASUSLinkNear
@@ -13,3 +14,4 @@ sc DELETE ASUSSoftwareManager
sc DELETE ASUSSwitch
sc DELETE ASUSSystemAnalysis
sc DELETE ASUSSystemDiagnosis
sc DELETE ArmouryCrateControlInterface

108
docs/README.md Normal file
View File

@@ -0,0 +1,108 @@
# [G-Helper (GHelper)](https://github.com/seerge/g-helper)
[![Github all releases](https://img.shields.io/github/downloads/seerge/g-helper/total.svg)](https://GitHub.com/seerge/g-helper/releases/) [![GitHub release](https://img.shields.io/github/release/seerge/g-helper.svg)](https://GitHub.com/seerge/g-helper/releases/) [![GitHub stars](https://img.shields.io/github/stars/seerge/g-helper.svg?style=social&label=Star&maxAge=2592000)](https://GitHub.com/seerge/g-helper/stargazers/)
## Open source Armoury Crate alternative for Asus ROG Zephyrus G14, G15, Flow X13, Flow X16, and other models
A small utility that allows you to do almost everything you could do with Armoury Crate but without extra bloat and unnecessary services.
### :gift: Main advantages
1. Seamless and automatic GPU switching (without asking you to close all apps, etc)
2. All performance modes can be fully customized (with fan curves and PPTs)
3. Very lightweight and consumes almost no resources, doesn't install any services. Just a single exe to run
### [:floppy_disk: Download latest release](https://github.com/seerge/g-helper/releases/latest/download/GHelper.zip)
If you like this app, please [star :star: it on Github](https://github.com/seerge/g-helper) and spread a word about it!
![Screenshot](https://raw.githubusercontent.com/seerge/g-helper/main/docs/screenshot.png)
### :zap: Main features
1. Built-in **Performance modes**: Silent - Balanced - Turbo (with default fan curves)
2. **GPU modes**: Eco - Standard - Ultimate - Optimized
3. Laptop screen refresh rate 60hz or 120hz (144hz, etc depending on the model) with display overdrive (OD)
4. Default and custom fan profiles for every performance mode
5. Power limits (PPT) for every performance mode
6. CPU turbo boost mode
7. Keyboard backlit animation and colors
8. Anime matrix control thanks to [Starlight](https://github.com/vddCore/Starlight) + some tweaks from my side (including animated GIFs)
9. FN+F5 cycles performance modes, FN+F4 cycles keyboard animation modes
10. Keybindings for M3 and M4 keys
11. Battery charge limit to preserve battery health
12. Monitor CPU / GPU temperature, fan speeds and battery discharge rate
### :apple: Automatic switching of modes when on battery or plugged in
- Performance modes (app remembers last mode used on battery or when plugged)
- Optimized GPU mode - disables dGPU on battery and enables when plugged
- Auto Screen refresh rate (60hz on battery, 120+ hz when plugged)
To keep auto switching and hotkeys working the app needs to stay in running in the tray. It doesn't consume any resources.
### :rocket: Performance Modes
Modes are **same** as in Armory Crate (as they are stored in bios), including default fan curves
1. Silent (minimal or no fans, 70W PPT total, up to 45W PPT to CPU) + Best power efficiency setting in windows
2. Balanced (balanced fans, 100W PPT total, up to 45W PPT to CPU) + Balanced setting in windows
3. Turbo (intense fans, 125W PPT total, up to 80W PPT to CPU) + Best performance setting in windows
PPTs are shown for G14 2022, for other models PPTs will be different as they are set in bios.
### :video_game: GPU Modes
1. Eco mode : only low power integrated GPU enabled, iGPU drives built in display
2. Standard mode (Windows Hybrid) : iGPU and dGPU enabled, iGPU drives built in display
3. Ultimate mode: iGPU and dGPU enabled, but dGPU drives built in display (supported only on G14 2022 model)
4. Optimized (formely existed as a checkbox): disables dGPU on battery (Eco) and enables when plugged (Standard)
### :question: FAQ
#### How do I stop Armory Crate install popup appearing every time I press M4 / Rog key?
Go to BIOS (F2 on boot), open Advanced Settings (F8) and disable "Armory Control Intrerface"
#### Why Ultimate GPU mode is not available on my laptop?
Ultimate mode is supported (by hardware) only on G14 2022 (and possibly other models from 2022+)
#### App doesn't start / or crashes, what should I do ?
Open "Event Viewer" from start menu, go to Windows Logs -> Application and check for recent Errors mentioning G-Helper. If you see one - please post a [new issue](https://github.com/seerge/g-helper/issues) with all details from this error.
----------------------------
### How to install
1. Download latest release from [**Releases Page**](https://github.com/seerge/g-helper/releases)
2. Unzip to a folder of your choice
3. Run **GHelper.exe**
### Dependencies
- App requires [.NET7](https://dotnet.microsoft.com/en-us/download) to be installed. Most probably you already have it. Otherwise you can [download it](https://dotnet.microsoft.com/en-us/download).
- I recommend keeping "Asus Optimization Service" running, as it keeps basic laptop hotkeys such as screen or keyboard brightness adjustment working. If you have (or had) MyASUS app installed, that service is most probably still up and running even after MyASUS uninstalls. It's part of [Asus System Control Interface](https://www.asus.com/support/FAQ/1047338/). You can install it, and later disable / remove unnecessary services by running [this bat file](https://raw.githubusercontent.com/seerge/g-helper/main/debloat.bat) as admin.
- It's not recommended to use an app in combination with Armory Crate, cause they adjust the same settings. You can [uninstall it using it's own uninstall tool](https://dlcdnets.asus.com/pub/ASUS/mb/14Utilities/Armoury_Crate_Uninstall_Tool.zip?model=armoury%20crate). Just in case, you can always install it back later.
Note: Doesn't need administrator privileges to run!
-------------------------------
Designed and developed for Asus Zephyrus G14 2022 (with AMD Radeon iGPU and dGPU). But could and should potentially work for G14 of 2021 and 2020, G15, X FLOW, and other ROG models for relevant and supported features.
I don't have a Microsoft certificate to sign the app yet, so if you get a warning from Windows Defender on launch (Windows Protected your PC), click More Info -> Run anyway. Alternatively you can compile and run project by yourself using Visual Studio :)
Settings file is stored at ``%AppData%\GHelper``
------------------
Debloating helps to save your battery and keep laptop a bit cooler
![Helps to save your battery](https://raw.githubusercontent.com/seerge/g-helper/main/docs/screenshots/screen-5w.png)
---------
**Disclaimers**
"ROG", "TUF", and "Armoury Crate" are trademarked by and belong to AsusTek Computer, Inc. I make no claims to these or any assets belonging to AsusTek Computer and use them purely for informational purposes only.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. MISUSE OF THIS SOFTWARE COULD CAUSE SYSTEM INSTABILITY OR MALFUNCTION.

4
docs/_config.yml Normal file
View File

@@ -0,0 +1,4 @@
title: G-Helper
description: Open source Armory Crate alternative for Asus ROG Zephyrus G14, G15, Flow X13, Flow X16, and other models
plugins:
- jemoji

View File

@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="{{ page.lang | default: site.lang | default: "en-US" }}">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% seo %}
<link rel="stylesheet" href="{{ "/assets/css/style.css?v=" | append: site.github.build_revision | relative_url }}">
{% include head-custom.html %}
</head>
<body>
<div class="container-lg px-3 my-5 markdown-body">
{{ content }}
{% if site.github.private != true and site.github.license %}
<div class="footer border-top border-gray-light mt-5 pt-3 text-right text-gray">
This site is open source. {% github_edit_link "Improve this page" %}.
</div>
{% endif %}
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.0/anchor.min.js" integrity="sha256-lZaRhKri35AyJSypXXs4o6OPFTbTmUoltBbDCbdzegg=" crossorigin="anonymous"></script>
<script>anchors.add();</script>
</body>
</html>

BIN
docs/screenshot-dark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
docs/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 MiB

View File

Before

Width:  |  Height:  |  Size: 955 KiB

After

Width:  |  Height:  |  Size: 955 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 MiB