mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
23 Commits
0.4.2
...
old_ps1_sc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52c6615ebc | ||
|
|
23405632ad | ||
|
|
52e2b8b31c | ||
|
|
b25eb63116 | ||
|
|
4bfbdd04cb | ||
|
|
efe887fbc3 | ||
|
|
5919bfd71e | ||
|
|
c9e25b6358 | ||
|
|
fb4a0cf3db | ||
|
|
b534becbf5 | ||
|
|
99316da55e | ||
|
|
cf92e04501 | ||
|
|
39514d89f6 | ||
|
|
293ab6f35d | ||
|
|
f2967fcc79 | ||
|
|
e060feaf09 | ||
|
|
178f61a98d | ||
|
|
79b8d6fa14 | ||
|
|
007f6ef1a3 | ||
|
|
1637f36d1d | ||
|
|
0f3f54c50a | ||
|
|
aff667345d | ||
|
|
b14ee181f9 |
33
.github/workflows/main.yml
vendored
Normal file
33
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: Main
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*.*"
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir release
|
||||
cp *.cmd ./release
|
||||
cp *.lnk ./release
|
||||
cp ghelper.ps1 ./release
|
||||
zip -r g14-helper-script.zip ./release
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: |
|
||||
g14-helper-script.zip
|
||||
g14-helper.exe
|
||||
|
||||
BIN
G14-Helper.lnk
Normal file
BIN
G14-Helper.lnk
Normal file
Binary file not shown.
46
README.md
46
README.md
@@ -1,26 +1,54 @@
|
||||
# G14-Helper
|
||||
|
||||
Designed for Asus Zephyrus G14 2022 (with AMD Radeon iGPU and dGPU). But could potentially work for G14 of 2021 and 2020, G15, X FLOW, and other ROG models.
|
||||
Designed 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.
|
||||
|
||||
A small windows system tray utility that allows you to switch between 3 main GPU modes (mirroring ones from ASUS Armory Crate). Uses ASUS WMI commands to do switching and doens't require Armory Crate to be isntalled at all. Requires Administrator priveledges on Windows to run.
|
||||
A tiny system tray utility that allows you set performance and GPU profiles for your laptop. Same as ASUS Armory Crate does but without it completely!.
|
||||
|
||||

|
||||
## Performance Profile switching
|
||||
|
||||
Profiles are **same** as in Armory Crate, including default fan curves
|
||||
|
||||
1. Silent (minimal or no fans, 45W PPT to CPU)
|
||||
2. Balanced (balanced fans, up to 45W PPT to CPU)
|
||||
3. Turbo (intense fans, 125W PPT total, up to 80W PPT to CPU)
|
||||
|
||||
## GPU Mode switching
|
||||
|
||||
1. Eco mode : only low power iGPU (Radeon 680u) enabled, iGPU drives built in display
|
||||
2. Standard mode (Windows Hybrid) : iGPU and dGPU (Radeon 6700s/6800s) enabled, iGPU drives built in display
|
||||
3. Ultimate mode: iGPU and dGPU enabled, but dGPU drives built in display
|
||||
|
||||
##UPDATE: February 12, 2023
|
||||
## Extras
|
||||
|
||||
1. Added switching of **Performance profiles (including default fan curves)** is also available! switching happens via same ASUS WMI low level commands. Profiles are same as in Armory Crate - Silent, Balanced and Turbo.
|
||||
1. **Maximum battery charge rate** limit (60% / 80% / 100%) to preserve your battery
|
||||
2. CPU and GPU relative fan speed monitoring
|
||||
3. Laptop screen refresh adjustments for power saving (60hz) and gaming (120hz)
|
||||
4. Laptop screen panel overdrive switch
|
||||
5. Start with windows (optional)
|
||||
|
||||
2. App now monitors (once every 3 seconds) fan speeds and shows them in the menu
|
||||
|
||||
3. App will save settings and write a basic log of it's actions to APPDATA\LOCAL directory
|
||||
## How to install
|
||||
|
||||
4. App will reapply Panel Overdrive and Performance mode on each start (based on last setting from config)
|
||||
1. Download latest release from https://github.com/seerge/g14-helper/releases
|
||||
2. Unzip to a folder of your choice
|
||||
3. Run **g14-helper.exe**
|
||||
|
||||
_App is written in Powershell and wrapped into executable with https://github.com/MScholtes/PS2EXE .
|
||||
If you don't trust exe - you can always run ghelper.ps1 script by yourself directly._
|
||||
|
||||
|
||||
Note: Uses low level ASUS WMI commands to do switching and doens't require Armory Crate to be isntalled at all.
|
||||
Therefore requires Administrator priveledges on Windows to run.
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
Settings and basic log are located in APPDATA\LOCAL
|
||||
|
||||
P.S.: It's not recommended to use app in combination with Armory Crate, cause they adjust same settings.
|
||||
Please keep in mind, that if you also run MyASUS app periodically it will also try to adjust same battery charge settings
|
||||
|
||||
Extra: **autostart.ps1** script to schedule autostart of the app (with admin privileges) on every user logon for convenience. Later will be integrated into main app.
|
||||
|
||||
--------
|
||||

|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
$taskName = "G14Helper"
|
||||
$task = Get-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue
|
||||
if ($task -ne $null)
|
||||
{
|
||||
Unregister-ScheduledTask -TaskName $taskName -Confirm:$false
|
||||
}
|
||||
|
||||
$scriptDir = Split-Path $PSCommandPath -Parent
|
||||
|
||||
# TODO: EDIT THIS STUFF AS NEEDED...
|
||||
$action = New-ScheduledTaskAction -Execute "$scriptDir\g14-helper.exe"
|
||||
$trigger = New-ScheduledTaskTrigger -AtLogon
|
||||
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
|
||||
|
||||
$principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -RunLevel Highest
|
||||
$definition = New-ScheduledTask -Action $action -Principal $principal -Trigger $trigger -Settings $settings -Description "Run $($taskName) at Logon"
|
||||
|
||||
Register-ScheduledTask -TaskName $taskName -InputObject $definition
|
||||
13
events.ps1
Normal file
13
events.ps1
Normal file
@@ -0,0 +1,13 @@
|
||||
Get-EventSubscriber | Unregister-Event
|
||||
|
||||
|
||||
$ProcessAsusWmiEvent = {
|
||||
$event_id = $Event.SourceEventArgs.NewEvent.EventID
|
||||
Write-Host $event_id
|
||||
}
|
||||
|
||||
Register-CimIndicationEvent -Namespace root\wmi -query "Select * From AsusAtkWmiEvent" ` -sourceIdentifier "GHAsus" ` -action $ProcessAsusWmiEvent
|
||||
|
||||
while (1) {
|
||||
|
||||
}
|
||||
1
g14-helper.cmd
Normal file
1
g14-helper.cmd
Normal file
@@ -0,0 +1 @@
|
||||
powershell -WindowStyle hidden -file ghelper.ps1
|
||||
BIN
g14-helper.exe
BIN
g14-helper.exe
Binary file not shown.
@@ -1,2 +1 @@
|
||||
ps2exe .\gpu.ps1 g14-helper.exe -title 'G14 Helper' -DPIAware -winFormsDPIAware -requireAdmin -iconFile 'standard.ico' -noConsole -copyright 'G14 Helper Tool' -noOutput
|
||||
.\g14-helper.exe
|
||||
ps2exe .\ghelper.ps1 g14-helper.exe -title 'G14 Helper' -DPIAware -winFormsDPIAware -requireAdmin -iconFile 'standard.ico' -noConsole -copyright 'G14 Helper Tool' -noOutput
|
||||
@@ -1,27 +1,40 @@
|
||||
[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms') | out-null
|
||||
[System.Reflection.Assembly]::LoadWithPartialName('presentationframework') | out-null
|
||||
[System.Reflection.Assembly]::LoadWithPartialName('System.Drawing') | out-null
|
||||
[System.Reflection.Assembly]::LoadWithPartialName('WindowsFormsIntegration') | out-null
|
||||
|
||||
|
||||
Function Get-PSScriptPath {
|
||||
if ([System.IO.Path]::GetExtension($PSCommandPath) -eq '.ps1') {
|
||||
$psScriptPath = $PSCommandPath
|
||||
} else {
|
||||
$psScriptPath = [System.Diagnostics.Process]::GetCurrentProcess().MainModule.FileName
|
||||
# Self-elevate the script
|
||||
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
|
||||
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
|
||||
$CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
|
||||
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine -WindowStyle Hidden
|
||||
Exit
|
||||
}
|
||||
return $psScriptPath
|
||||
}
|
||||
|
||||
# DPI Awareness
|
||||
Add-Type -TypeDefinition @'
|
||||
using System.Runtime.InteropServices;
|
||||
public class ProcessDPI {
|
||||
[DllImport("user32.dll", SetLastError=true)]
|
||||
public static extern bool SetProcessDPIAware();
|
||||
}
|
||||
'@
|
||||
$null = [ProcessDPI]::SetProcessDPIAware()
|
||||
[System.Windows.Forms.Application]::EnableVisualStyles()
|
||||
|
||||
Add-Type -AssemblyName PresentationFramework
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
Add-Type -AssemblyName WindowsFormsIntegration
|
||||
|
||||
function SetAutostart () {
|
||||
$taskName = "G14Helper"
|
||||
$task = Get-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue
|
||||
if ($task -ne $null) {return }
|
||||
if ($null -ne $task) {return }
|
||||
|
||||
$scriptDir = Get-PSScriptPath
|
||||
if ([System.IO.Path]::GetExtension($PSCommandPath) -eq '.ps1') {
|
||||
$action = New-ScheduledTaskAction -Execute "powershell" -Argument "-WindowStyle Hidden -File $PSCommandPath"
|
||||
} else {
|
||||
$psScriptPath = [System.Diagnostics.Process]::GetCurrentProcess().MainModule.FileName
|
||||
$action = New-ScheduledTaskAction -Execute $psScriptPath
|
||||
}
|
||||
|
||||
$action = New-ScheduledTaskAction -Execute $scriptDir
|
||||
$trigger = New-ScheduledTaskTrigger -AtLogon
|
||||
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
|
||||
|
||||
@@ -34,7 +47,7 @@ function SetAutostart () {
|
||||
|
||||
function CheckAutostart () {
|
||||
$task = Get-ScheduledTask -TaskName "G14Helper" -ErrorAction SilentlyContinue
|
||||
$Menu_Autostart.Checked = ($task -ne $null)
|
||||
$Menu_Autostart.Checked = ($null -ne $task)
|
||||
}
|
||||
|
||||
function DisableAutostart () {
|
||||
@@ -190,8 +203,8 @@ $icon_ultimate = [Drawing.Icon][IO.MemoryStream][Convert]::FromBase64String("AAA
|
||||
|
||||
# Init Config and Log
|
||||
$ghelper_app_path = "$($env:LOCALAPPDATA)\GHelper"
|
||||
$ghelper_config_path = "$($env:LOCALAPPDATA)\GHelper\config.json"
|
||||
$ghelper_log_path = "$($env:LOCALAPPDATA)\GHelper\log.txt"
|
||||
$ghelper_config_path = "$ghelper_app_path\config.json"
|
||||
$ghelper_log_path = "$ghelper_app_path\log.txt"
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $ghelper_app_path
|
||||
|
||||
@@ -203,6 +216,7 @@ $Main_Tool_Icon.Visible = $true
|
||||
|
||||
$Menu_Perf_Title = New-Object System.Windows.Forms.MenuItem("Mode")
|
||||
$Menu_Perf_Title.Enabled = $false
|
||||
|
||||
$Menu_Perf_Silent = New-Object System.Windows.Forms.MenuItem("Silent")
|
||||
$Menu_Perf_Balanced = New-Object System.Windows.Forms.MenuItem("Balanced")
|
||||
$Menu_Perf_Turbo = New-Object System.Windows.Forms.MenuItem("Turbo")
|
||||
@@ -229,30 +243,46 @@ $Menu_Autostart = New-Object System.Windows.Forms.MenuItem("Run on startup")
|
||||
$Menu_Exit = New-Object System.Windows.Forms.MenuItem("Exit")
|
||||
|
||||
$contextmenu = New-Object System.Windows.Forms.ContextMenu
|
||||
|
||||
$contextmenu.MenuItems.AddRange($Menu_Perf_Title)
|
||||
$contextmenu.MenuItems.AddRange($Menu_Perf_Silent)
|
||||
$contextmenu.MenuItems.AddRange($Menu_Perf_Balanced)
|
||||
$contextmenu.MenuItems.AddRange($Menu_Perf_Turbo)
|
||||
$contextmenu.MenuItems.AddRange("-")
|
||||
|
||||
$contextmenu.MenuItems.AddRange($Menu_Title)
|
||||
$contextmenu.MenuItems.AddRange($Menu_Eco)
|
||||
$contextmenu.MenuItems.AddRange($Menu_Standard)
|
||||
$contextmenu.MenuItems.AddRange($Menu_Ultimate)
|
||||
$contextmenu.MenuItems.AddRange("-")
|
||||
|
||||
$contextmenu.MenuItems.AddRange($Menu_RR)
|
||||
$contextmenu.MenuItems.AddRange($Menu_RR60)
|
||||
$contextmenu.MenuItems.AddRange($Menu_RR120)
|
||||
$contextmenu.MenuItems.AddRange($Menu_OD)
|
||||
|
||||
$contextmenu.MenuItems.AddRange("-")
|
||||
|
||||
$Menu_Charge60 = New-Object System.Windows.Forms.MenuItem("60%")
|
||||
$Menu_Charge80 = New-Object System.Windows.Forms.MenuItem("80%")
|
||||
$Menu_Charge100 = New-Object System.Windows.Forms.MenuItem("100%")
|
||||
|
||||
$Submenu_Charge = New-Object System.Windows.Forms.MenuItem("Charge Limit")
|
||||
$Submenu_Charge.MenuItems.AddRange($Menu_Charge60)
|
||||
$Submenu_Charge.MenuItems.AddRange($Menu_Charge80)
|
||||
$Submenu_Charge.MenuItems.AddRange($Menu_Charge100)
|
||||
$contextmenu.MenuItems.AddRange($Submenu_Charge)
|
||||
|
||||
|
||||
$contextmenu.MenuItems.AddRange("-")
|
||||
$contextmenu.MenuItems.AddRange($Menu_Autostart)
|
||||
|
||||
$contextmenu.MenuItems.AddRange("-")
|
||||
$contextmenu.MenuItems.AddRange($Menu_Exit)
|
||||
|
||||
|
||||
$Main_Tool_Icon.ContextMenu = $contextmenu
|
||||
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange($Menu_Perf_Title)
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange($Menu_Perf_Silent)
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange($Menu_Perf_Balanced)
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange($Menu_Perf_Turbo)
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange("-")
|
||||
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange($Menu_Title)
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange($Menu_Eco)
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange($Menu_Standard)
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange($Menu_Ultimate)
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange("-")
|
||||
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange($Menu_RR)
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange($Menu_RR60)
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange($Menu_RR120)
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange($Menu_OD)
|
||||
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange("-")
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange($Menu_Autostart)
|
||||
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange("-")
|
||||
$Main_Tool_Icon.contextMenu.MenuItems.AddRange($Menu_Exit)
|
||||
|
||||
# Hardware Initialisation
|
||||
|
||||
@@ -389,13 +419,40 @@ function SetPeformanceMode ($performance_mode = 0) {
|
||||
SaveConfigSetting -Name 'performance_mode' -Value $performance_mode
|
||||
UICheckStats
|
||||
|
||||
Invoke-CimMethod $asushw -MethodName DEVS -Arguments @{Device_ID=$device_performance ; Control_status=$performance_mode }
|
||||
Invoke-CimMethod $asushw -MethodName DEVS -Arguments @{Device_ID=$device_performance ; Control_status=$performance_mode } | Out-Null
|
||||
WriteLog("Performance set to "+$performance_mode)
|
||||
}
|
||||
|
||||
function SetChargeLimit ($charge_limit = 100) {
|
||||
|
||||
$Menu_Charge60.Checked = $false;
|
||||
$Menu_Charge80.Checked = $false;
|
||||
$Menu_Charge100.Checked = $false;
|
||||
|
||||
switch ($charge_limit)
|
||||
{
|
||||
60 {
|
||||
$Menu_Charge60.Checked = $true
|
||||
}
|
||||
80 {
|
||||
$Menu_Charge80.Checked = $true
|
||||
}
|
||||
Default {
|
||||
$Menu_Charge100.Checked = $true
|
||||
$charge_limit = 100
|
||||
}
|
||||
}
|
||||
|
||||
SaveConfigSetting -Name 'charge_limit' -Value $charge_limit
|
||||
$Submenu_Charge.Text = "Charge Limit: $charge_limit%"
|
||||
Invoke-CimMethod $asushw -MethodName DEVS -Arguments @{Device_ID=0x00120057 ; Control_status=$charge_limit } | Out-Null
|
||||
WriteLog("Charge limit set to "+$charge_limit)
|
||||
}
|
||||
|
||||
|
||||
function SetPanelOverdrive ($overdrive = 1) {
|
||||
SaveConfigSetting -Name 'panel_overdrive' -Value $overdrive
|
||||
Invoke-CimMethod $asushw -MethodName DEVS -Arguments @{Device_ID=$device_overdrive ; Control_status=$overdrive }
|
||||
Invoke-CimMethod $asushw -MethodName DEVS -Arguments @{Device_ID=$device_overdrive ; Control_status=$overdrive } | Out-Null
|
||||
WriteLog("Panel Overdrive set to "+$overdrive)
|
||||
}
|
||||
|
||||
@@ -487,7 +544,7 @@ function UIGPUMode ($gpu_mode) {
|
||||
$Main_Tool_Icon.Icon = $icon_eco
|
||||
}
|
||||
"ultimate" {
|
||||
$script:title_gpu = "GPU: dGPU exclusive"
|
||||
$script:title_gpu = "GPU: dGPU"
|
||||
$Menu_Ultimate.Checked = $true
|
||||
$Main_Tool_Icon.Icon = $icon_ultimate
|
||||
}
|
||||
@@ -507,6 +564,7 @@ LoadConfig
|
||||
|
||||
SetPeformanceMode(GetConfigSetting('performance_mode'))
|
||||
SetPanelOverdrive(GetConfigSetting('panel_overdrive'))
|
||||
SetChargeLimit(GetConfigSetting('charge_limit'))
|
||||
|
||||
GetGPUMode
|
||||
|
||||
@@ -566,6 +624,18 @@ $Menu_RR120.add_Click({
|
||||
CheckScreen
|
||||
})
|
||||
|
||||
$Menu_Charge60.add_Click({
|
||||
SetChargeLimit(60)
|
||||
})
|
||||
|
||||
$Menu_Charge80.add_Click({
|
||||
SetChargeLimit(80)
|
||||
})
|
||||
|
||||
$Menu_Charge100.add_Click({
|
||||
SetChargeLimit(100)
|
||||
})
|
||||
|
||||
$Menu_OD.add_Click({
|
||||
if ($Menu_OD.Checked) {
|
||||
SetPanelOverdrive(0)
|
||||
@@ -590,11 +660,19 @@ $Menu_Exit.add_Click({
|
||||
$Main_Tool_Icon.Visible = $false
|
||||
Stop-Process $pid
|
||||
})
|
||||
|
||||
|
||||
|
||||
# Make PowerShell Disappear
|
||||
$windowcode = '[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);'
|
||||
$asyncwindow = Add-Type -MemberDefinition $windowcode -name Win32ShowWindowAsync -namespace Win32Functions -PassThru
|
||||
$null = $asyncwindow::ShowWindowAsync((Get-Process -PID $pid).MainWindowHandle, 0)
|
||||
|
||||
# Force garbage collection just to start slightly lower RAM usage.
|
||||
[System.GC]::Collect()
|
||||
|
||||
# Create an application context for it to all run within.
|
||||
# This helps with responsiveness, especially when clicking Exit.
|
||||
$appContext = New-Object System.Windows.Forms.ApplicationContext
|
||||
[void][System.Windows.Forms.Application]::Run($appContext)
|
||||
[void][System.Windows.Forms.Application]::Run($appContext)
|
||||
|
||||
|
||||
BIN
resources/icons8-charging-battery-48.png
Normal file
BIN
resources/icons8-charging-battery-48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 421 B |
BIN
resources/icons8-laptop-48.png
Normal file
BIN
resources/icons8-laptop-48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 260 B |
BIN
resources/icons8-speed-48.png
Normal file
BIN
resources/icons8-speed-48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 885 B |
BIN
resources/icons8-video-card-48.png
Normal file
BIN
resources/icons8-video-card-48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 400 B |
Reference in New Issue
Block a user