From 0fec4c9620d05ea01bdb4febb4bcaa1e98196ba1 Mon Sep 17 00:00:00 2001
From: Serge <5920850+seerge@users.noreply.github.com>
Date: Sat, 5 Aug 2023 13:17:50 +0200
Subject: [PATCH] Optimized USB-C fix
---
app/GHelper.csproj | 2 +-
app/Gpu/GPUModeControl.cs | 10 +++++++---
app/Input/InputDispatcher.cs | 1 -
app/Settings.Designer.cs | 4 ++--
4 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/app/GHelper.csproj b/app/GHelper.csproj
index 91891343..fa57c791 100644
--- a/app/GHelper.csproj
+++ b/app/GHelper.csproj
@@ -15,7 +15,7 @@
AnyCPU
False
True
- 0.105
+ 0.106
diff --git a/app/Gpu/GPUModeControl.cs b/app/Gpu/GPUModeControl.cs
index 15aa4a0d..bf437039 100644
--- a/app/Gpu/GPUModeControl.cs
+++ b/app/Gpu/GPUModeControl.cs
@@ -176,10 +176,14 @@ namespace GHelper.Gpu
public static bool IsPlugged()
{
- bool optimizedUSBC = AppConfig.Get("optimized_usbc") != 1;
+ if (SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online) return false;
+ if (!AppConfig.Is("optimized_usbc")) return true;
- return SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online &&
- (optimizedUSBC || Program.acpi.DeviceGet(AsusACPI.ChargerMode) < AsusACPI.ChargerUSB);
+ int chargerMode = Program.acpi.DeviceGet(AsusACPI.ChargerMode);
+ Logger.WriteLine("ChargerStatus: " + chargerMode);
+
+ if (chargerMode < 0) return true;
+ return (chargerMode & AsusACPI.ChargerBarrel) > 0;
}
diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs
index 91617ec3..52f59cbf 100644
--- a/app/Input/InputDispatcher.cs
+++ b/app/Input/InputDispatcher.cs
@@ -436,7 +436,6 @@ namespace GHelper.Input
KeyProcess("paddle");
return;
// The Command Center ("play-looking") button below the select key.
- // We'll call this M3.
case 166:
KeyProcess("cc");
return;
diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs
index c37b990f..0059972f 100644
--- a/app/Settings.Designer.cs
+++ b/app/Settings.Designer.cs
@@ -438,7 +438,7 @@ namespace GHelper
// checkStartup
//
checkStartup.AutoSize = true;
- checkStartup.Location = new Point(36, 11);
+ checkStartup.Location = new Point(24, 11);
checkStartup.Margin = new Padding(11, 5, 11, 5);
checkStartup.Name = "checkStartup";
checkStartup.Size = new Size(206, 36);
@@ -1202,7 +1202,7 @@ namespace GHelper
labelCharge.Dock = DockStyle.Right;
labelCharge.ForeColor = SystemColors.ControlDark;
labelCharge.Location = new Point(365, 0);
- labelCharge.Margin = new Padding(0, 0, 0, 0);
+ labelCharge.Margin = new Padding(0);
labelCharge.Name = "labelCharge";
labelCharge.Padding = new Padding(0, 0, 20, 0);
labelCharge.Size = new Size(462, 56);