mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Ally Backlight Button
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using GHelper.Gpu.AMD;
|
using GHelper.Gpu.AMD;
|
||||||
|
using GHelper.Input;
|
||||||
using GHelper.USB;
|
using GHelper.USB;
|
||||||
|
|
||||||
namespace GHelper.Ally
|
namespace GHelper.Ally
|
||||||
@@ -19,7 +20,6 @@ namespace GHelper.Ally
|
|||||||
SettingsForm settings;
|
SettingsForm settings;
|
||||||
|
|
||||||
ControllerMode mode = ControllerMode.Auto;
|
ControllerMode mode = ControllerMode.Auto;
|
||||||
|
|
||||||
ControllerMode _autoMode = ControllerMode.Gamepad;
|
ControllerMode _autoMode = ControllerMode.Gamepad;
|
||||||
int _autoCount = 0;
|
int _autoCount = 0;
|
||||||
|
|
||||||
@@ -60,8 +60,15 @@ namespace GHelper.Ally
|
|||||||
if (AppConfig.IsAlly()) settings.VisualiseAlly(true);
|
if (AppConfig.IsAlly()) settings.VisualiseAlly(true);
|
||||||
else return;
|
else return;
|
||||||
|
|
||||||
mode = (ControllerMode)AppConfig.Get("controller_mode", (int)ControllerMode.Auto);
|
SetMode((ControllerMode)AppConfig.Get("controller_mode", (int)ControllerMode.Auto));
|
||||||
SetMode(mode);
|
settings.VisualiseBacklight(InputDispatcher.GetBacklight());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ToggleBacklight()
|
||||||
|
{
|
||||||
|
InputDispatcher.SetBacklight(4, true);
|
||||||
|
settings.VisualiseBacklight(InputDispatcher.GetBacklight());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetMode(ControllerMode mode)
|
private void SetMode(ControllerMode mode)
|
||||||
@@ -78,7 +85,6 @@ namespace GHelper.Ally
|
|||||||
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 1, 1, (byte)mode }, "ControllerMode");
|
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 1, 1, (byte)mode }, "ControllerMode");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AppConfig.Set("controller_mode", (int)mode);
|
AppConfig.Set("controller_mode", (int)mode);
|
||||||
settings.VisualiseController(mode);
|
settings.VisualiseController(mode);
|
||||||
}
|
}
|
||||||
|
|||||||
61
app/Settings.Designer.cs
generated
61
app/Settings.Designer.cs
generated
@@ -109,12 +109,12 @@ namespace GHelper
|
|||||||
picturePeripherals = new PictureBox();
|
picturePeripherals = new PictureBox();
|
||||||
labelPeripherals = new Label();
|
labelPeripherals = new Label();
|
||||||
panelAlly = new Panel();
|
panelAlly = new Panel();
|
||||||
label1 = new Label();
|
|
||||||
tableLayoutAlly = new TableLayoutPanel();
|
tableLayoutAlly = new TableLayoutPanel();
|
||||||
buttonController = new RButton();
|
buttonController = new RButton();
|
||||||
panelAllyTitle = new Panel();
|
panelAllyTitle = new Panel();
|
||||||
pictureAlly = new PictureBox();
|
pictureAlly = new PictureBox();
|
||||||
labelAlly = new Label();
|
labelAlly = new Label();
|
||||||
|
buttonBacklight = new RButton();
|
||||||
panelMatrix.SuspendLayout();
|
panelMatrix.SuspendLayout();
|
||||||
tableLayoutMatrix.SuspendLayout();
|
tableLayoutMatrix.SuspendLayout();
|
||||||
panelMatrixTitle.SuspendLayout();
|
panelMatrixTitle.SuspendLayout();
|
||||||
@@ -293,7 +293,7 @@ namespace GHelper
|
|||||||
panelBattery.Controls.Add(sliderBattery);
|
panelBattery.Controls.Add(sliderBattery);
|
||||||
panelBattery.Controls.Add(panelBatteryTitle);
|
panelBattery.Controls.Add(panelBatteryTitle);
|
||||||
panelBattery.Dock = DockStyle.Top;
|
panelBattery.Dock = DockStyle.Top;
|
||||||
panelBattery.Location = new Point(11, 1441);
|
panelBattery.Location = new Point(11, 1405);
|
||||||
panelBattery.Margin = new Padding(0);
|
panelBattery.Margin = new Padding(0);
|
||||||
panelBattery.Name = "panelBattery";
|
panelBattery.Name = "panelBattery";
|
||||||
panelBattery.Padding = new Padding(20, 20, 20, 10);
|
panelBattery.Padding = new Padding(20, 20, 20, 10);
|
||||||
@@ -385,7 +385,7 @@ namespace GHelper
|
|||||||
panelFooter.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
panelFooter.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
panelFooter.Controls.Add(tableButtons);
|
panelFooter.Controls.Add(tableButtons);
|
||||||
panelFooter.Dock = DockStyle.Top;
|
panelFooter.Dock = DockStyle.Top;
|
||||||
panelFooter.Location = new Point(11, 1616);
|
panelFooter.Location = new Point(11, 1580);
|
||||||
panelFooter.Margin = new Padding(0);
|
panelFooter.Margin = new Padding(0);
|
||||||
panelFooter.Name = "panelFooter";
|
panelFooter.Name = "panelFooter";
|
||||||
panelFooter.Padding = new Padding(20);
|
panelFooter.Padding = new Padding(20);
|
||||||
@@ -1067,7 +1067,7 @@ namespace GHelper
|
|||||||
panelKeyboard.Controls.Add(tableLayoutKeyboard);
|
panelKeyboard.Controls.Add(tableLayoutKeyboard);
|
||||||
panelKeyboard.Controls.Add(panelKeyboardTitle);
|
panelKeyboard.Controls.Add(panelKeyboardTitle);
|
||||||
panelKeyboard.Dock = DockStyle.Top;
|
panelKeyboard.Dock = DockStyle.Top;
|
||||||
panelKeyboard.Location = new Point(11, 923);
|
panelKeyboard.Location = new Point(11, 1063);
|
||||||
panelKeyboard.Margin = new Padding(0);
|
panelKeyboard.Margin = new Padding(0);
|
||||||
panelKeyboard.Name = "panelKeyboard";
|
panelKeyboard.Name = "panelKeyboard";
|
||||||
panelKeyboard.Padding = new Padding(20);
|
panelKeyboard.Padding = new Padding(20);
|
||||||
@@ -1243,7 +1243,7 @@ namespace GHelper
|
|||||||
panelVersion.Controls.Add(labelCharge);
|
panelVersion.Controls.Add(labelCharge);
|
||||||
panelVersion.Controls.Add(checkStartup);
|
panelVersion.Controls.Add(checkStartup);
|
||||||
panelVersion.Dock = DockStyle.Top;
|
panelVersion.Dock = DockStyle.Top;
|
||||||
panelVersion.Location = new Point(11, 1560);
|
panelVersion.Location = new Point(11, 1524);
|
||||||
panelVersion.Margin = new Padding(4);
|
panelVersion.Margin = new Padding(4);
|
||||||
panelVersion.Name = "panelVersion";
|
panelVersion.Name = "panelVersion";
|
||||||
panelVersion.Size = new Size(827, 56);
|
panelVersion.Size = new Size(827, 56);
|
||||||
@@ -1268,7 +1268,7 @@ namespace GHelper
|
|||||||
panelPeripherals.Controls.Add(tableLayoutPeripherals);
|
panelPeripherals.Controls.Add(tableLayoutPeripherals);
|
||||||
panelPeripherals.Controls.Add(panelPeripheralsTile);
|
panelPeripherals.Controls.Add(panelPeripheralsTile);
|
||||||
panelPeripherals.Dock = DockStyle.Top;
|
panelPeripherals.Dock = DockStyle.Top;
|
||||||
panelPeripherals.Location = new Point(11, 1243);
|
panelPeripherals.Location = new Point(11, 1207);
|
||||||
panelPeripherals.Margin = new Padding(0);
|
panelPeripherals.Margin = new Padding(0);
|
||||||
panelPeripherals.Name = "panelPeripherals";
|
panelPeripherals.Name = "panelPeripherals";
|
||||||
panelPeripherals.Padding = new Padding(20, 20, 20, 10);
|
panelPeripherals.Padding = new Padding(20, 20, 20, 10);
|
||||||
@@ -1407,29 +1407,18 @@ namespace GHelper
|
|||||||
panelAlly.AccessibleRole = AccessibleRole.Grouping;
|
panelAlly.AccessibleRole = AccessibleRole.Grouping;
|
||||||
panelAlly.AutoSize = true;
|
panelAlly.AutoSize = true;
|
||||||
panelAlly.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
panelAlly.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
panelAlly.Controls.Add(label1);
|
|
||||||
panelAlly.Controls.Add(tableLayoutAlly);
|
panelAlly.Controls.Add(tableLayoutAlly);
|
||||||
panelAlly.Controls.Add(panelAllyTitle);
|
panelAlly.Controls.Add(panelAllyTitle);
|
||||||
panelAlly.Dock = DockStyle.Top;
|
panelAlly.Dock = DockStyle.Top;
|
||||||
panelAlly.Location = new Point(11, 1067);
|
panelAlly.Location = new Point(11, 923);
|
||||||
panelAlly.Margin = new Padding(0);
|
panelAlly.Margin = new Padding(0);
|
||||||
panelAlly.Name = "panelAlly";
|
panelAlly.Name = "panelAlly";
|
||||||
panelAlly.Padding = new Padding(20, 20, 20, 0);
|
panelAlly.Padding = new Padding(20, 20, 20, 0);
|
||||||
panelAlly.Size = new Size(827, 176);
|
panelAlly.Size = new Size(827, 140);
|
||||||
panelAlly.TabIndex = 8;
|
panelAlly.TabIndex = 8;
|
||||||
panelAlly.TabStop = true;
|
panelAlly.TabStop = true;
|
||||||
panelAlly.Visible = false;
|
panelAlly.Visible = false;
|
||||||
//
|
//
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.Dock = DockStyle.Top;
|
|
||||||
label1.ForeColor = SystemColors.GrayText;
|
|
||||||
label1.Location = new Point(20, 140);
|
|
||||||
label1.Margin = new Padding(4, 0, 4, 0);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new Size(787, 36);
|
|
||||||
label1.TabIndex = 24;
|
|
||||||
//
|
|
||||||
// tableLayoutAlly
|
// tableLayoutAlly
|
||||||
//
|
//
|
||||||
tableLayoutAlly.AutoSize = true;
|
tableLayoutAlly.AutoSize = true;
|
||||||
@@ -1438,6 +1427,7 @@ namespace GHelper
|
|||||||
tableLayoutAlly.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
tableLayoutAlly.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
||||||
tableLayoutAlly.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
tableLayoutAlly.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
||||||
tableLayoutAlly.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
tableLayoutAlly.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
||||||
|
tableLayoutAlly.Controls.Add(buttonBacklight, 0, 0);
|
||||||
tableLayoutAlly.Controls.Add(buttonController, 0, 0);
|
tableLayoutAlly.Controls.Add(buttonController, 0, 0);
|
||||||
tableLayoutAlly.Dock = DockStyle.Top;
|
tableLayoutAlly.Dock = DockStyle.Top;
|
||||||
tableLayoutAlly.Location = new Point(20, 60);
|
tableLayoutAlly.Location = new Point(20, 60);
|
||||||
@@ -1458,6 +1448,8 @@ namespace GHelper
|
|||||||
buttonController.FlatAppearance.BorderSize = 0;
|
buttonController.FlatAppearance.BorderSize = 0;
|
||||||
buttonController.FlatStyle = FlatStyle.Flat;
|
buttonController.FlatStyle = FlatStyle.Flat;
|
||||||
buttonController.ForeColor = SystemColors.ControlText;
|
buttonController.ForeColor = SystemColors.ControlText;
|
||||||
|
buttonController.Image = Properties.Resources.icons8_game_controller_48;
|
||||||
|
buttonController.ImageAlign = ContentAlignment.MiddleRight;
|
||||||
buttonController.Location = new Point(4, 4);
|
buttonController.Location = new Point(4, 4);
|
||||||
buttonController.Margin = new Padding(4);
|
buttonController.Margin = new Padding(4);
|
||||||
buttonController.Name = "buttonController";
|
buttonController.Name = "buttonController";
|
||||||
@@ -1465,6 +1457,7 @@ namespace GHelper
|
|||||||
buttonController.Size = new Size(254, 72);
|
buttonController.Size = new Size(254, 72);
|
||||||
buttonController.TabIndex = 9;
|
buttonController.TabIndex = 9;
|
||||||
buttonController.Text = Properties.Strings.AutoMode;
|
buttonController.Text = Properties.Strings.AutoMode;
|
||||||
|
buttonController.TextImageRelation = TextImageRelation.ImageBeforeText;
|
||||||
buttonController.UseVisualStyleBackColor = false;
|
buttonController.UseVisualStyleBackColor = false;
|
||||||
//
|
//
|
||||||
// panelAllyTitle
|
// panelAllyTitle
|
||||||
@@ -1496,9 +1489,31 @@ namespace GHelper
|
|||||||
labelAlly.Location = new Point(42, -2);
|
labelAlly.Location = new Point(42, -2);
|
||||||
labelAlly.Margin = new Padding(8, 0, 8, 0);
|
labelAlly.Margin = new Padding(8, 0, 8, 0);
|
||||||
labelAlly.Name = "labelAlly";
|
labelAlly.Name = "labelAlly";
|
||||||
labelAlly.Size = new Size(58, 32);
|
labelAlly.Size = new Size(181, 32);
|
||||||
labelAlly.TabIndex = 26;
|
labelAlly.TabIndex = 26;
|
||||||
labelAlly.Text = "Ally";
|
labelAlly.Text = "Ally Controller";
|
||||||
|
//
|
||||||
|
// buttonBacklight
|
||||||
|
//
|
||||||
|
buttonBacklight.Activated = false;
|
||||||
|
buttonBacklight.BackColor = SystemColors.ControlLightLight;
|
||||||
|
buttonBacklight.BorderColor = Color.Transparent;
|
||||||
|
buttonBacklight.BorderRadius = 5;
|
||||||
|
buttonBacklight.Dock = DockStyle.Fill;
|
||||||
|
buttonBacklight.FlatAppearance.BorderSize = 0;
|
||||||
|
buttonBacklight.FlatStyle = FlatStyle.Flat;
|
||||||
|
buttonBacklight.ForeColor = SystemColors.ControlText;
|
||||||
|
buttonBacklight.Image = Properties.Resources.backlight;
|
||||||
|
buttonBacklight.ImageAlign = ContentAlignment.MiddleRight;
|
||||||
|
buttonBacklight.Location = new Point(266, 4);
|
||||||
|
buttonBacklight.Margin = new Padding(4);
|
||||||
|
buttonBacklight.Name = "buttonBacklight";
|
||||||
|
buttonBacklight.Secondary = false;
|
||||||
|
buttonBacklight.Size = new Size(254, 72);
|
||||||
|
buttonBacklight.TabIndex = 10;
|
||||||
|
buttonBacklight.Text = "100%";
|
||||||
|
buttonBacklight.TextImageRelation = TextImageRelation.ImageBeforeText;
|
||||||
|
buttonBacklight.UseVisualStyleBackColor = false;
|
||||||
//
|
//
|
||||||
// SettingsForm
|
// SettingsForm
|
||||||
//
|
//
|
||||||
@@ -1511,8 +1526,8 @@ namespace GHelper
|
|||||||
Controls.Add(panelVersion);
|
Controls.Add(panelVersion);
|
||||||
Controls.Add(panelBattery);
|
Controls.Add(panelBattery);
|
||||||
Controls.Add(panelPeripherals);
|
Controls.Add(panelPeripherals);
|
||||||
Controls.Add(panelAlly);
|
|
||||||
Controls.Add(panelKeyboard);
|
Controls.Add(panelKeyboard);
|
||||||
|
Controls.Add(panelAlly);
|
||||||
Controls.Add(panelMatrix);
|
Controls.Add(panelMatrix);
|
||||||
Controls.Add(panelScreen);
|
Controls.Add(panelScreen);
|
||||||
Controls.Add(panelGPU);
|
Controls.Add(panelGPU);
|
||||||
@@ -1665,11 +1680,11 @@ namespace GHelper
|
|||||||
private RButton buttonFnLock;
|
private RButton buttonFnLock;
|
||||||
private RButton buttonBatteryFull;
|
private RButton buttonBatteryFull;
|
||||||
private Panel panelAlly;
|
private Panel panelAlly;
|
||||||
private Label label1;
|
|
||||||
private TableLayoutPanel tableLayoutAlly;
|
private TableLayoutPanel tableLayoutAlly;
|
||||||
private RButton buttonController;
|
private RButton buttonController;
|
||||||
private Panel panelAllyTitle;
|
private Panel panelAllyTitle;
|
||||||
private Label labelAlly;
|
private Label labelAlly;
|
||||||
private PictureBox pictureAlly;
|
private PictureBox pictureAlly;
|
||||||
|
private RButton buttonBacklight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,6 +231,7 @@ namespace GHelper
|
|||||||
buttonBatteryFull.Click += ButtonBatteryFull_Click;
|
buttonBatteryFull.Click += ButtonBatteryFull_Click;
|
||||||
|
|
||||||
buttonController.Click += ButtonController_Click;
|
buttonController.Click += ButtonController_Click;
|
||||||
|
buttonBacklight.Click += ButtonBacklight_Click;
|
||||||
|
|
||||||
Text = "G-Helper " + (ProcessHelper.IsUserAdministrator() ? "—" : "-") + " " + AppConfig.GetModelShort();
|
Text = "G-Helper " + (ProcessHelper.IsUserAdministrator() ? "—" : "-") + " " + AppConfig.GetModelShort();
|
||||||
TopMost = AppConfig.Is("topmost");
|
TopMost = AppConfig.Is("topmost");
|
||||||
@@ -245,6 +246,11 @@ namespace GHelper
|
|||||||
panelPerformance.Focus();
|
panelPerformance.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ButtonBacklight_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
allyControl.ToggleBacklight();
|
||||||
|
}
|
||||||
|
|
||||||
private void ButtonController_Click(object? sender, EventArgs e)
|
private void ButtonController_Click(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
allyControl.ToggleMode();
|
allyControl.ToggleMode();
|
||||||
@@ -255,8 +261,8 @@ namespace GHelper
|
|||||||
if (!visible) return;
|
if (!visible) return;
|
||||||
|
|
||||||
panelAlly.Visible = true;
|
panelAlly.Visible = true;
|
||||||
labelKeyboard.Text = "Backlight";
|
panelKeyboardTitle.Visible = false;
|
||||||
buttonFnLock.Visible = false;
|
panelKeyboard.Padding = new Padding(20, 0, 20, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void VisualiseController(ControllerMode mode)
|
public void VisualiseController(ControllerMode mode)
|
||||||
@@ -275,6 +281,11 @@ namespace GHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void VisualiseBacklight(int backlight)
|
||||||
|
{
|
||||||
|
buttonBacklight.Text = Math.Round((double)backlight*33.33).ToString() + "%";
|
||||||
|
}
|
||||||
|
|
||||||
private void SettingsForm_LostFocus(object? sender, EventArgs e)
|
private void SettingsForm_LostFocus(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
lastLostFocus = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
lastLostFocus = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||||
|
|||||||
Reference in New Issue
Block a user