mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
m1,m2 bindings
This commit is contained in:
@@ -56,6 +56,10 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
if (combo.SelectedValue is not null)
|
if (combo.SelectedValue is not null)
|
||||||
AppConfig.setConfig(name, combo.SelectedValue.ToString());
|
AppConfig.setConfig(name, combo.SelectedValue.ToString());
|
||||||
|
|
||||||
|
if (name == "m1" || name == "m2")
|
||||||
|
Program.inputDispatcher.RegisterKeys();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
txbox.Text = AppConfig.getConfigString(name + "_custom");
|
txbox.Text = AppConfig.getConfigString(name + "_custom");
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using NAudio.CoreAudioApi;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using Tools;
|
using Tools;
|
||||||
|
using static NativeMethods;
|
||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
{
|
{
|
||||||
@@ -12,6 +13,10 @@ namespace GHelper
|
|||||||
private static bool isOptimizationRunning = OptimizationService.IsRunning();
|
private static bool isOptimizationRunning = OptimizationService.IsRunning();
|
||||||
private static nint windowHandle;
|
private static nint windowHandle;
|
||||||
|
|
||||||
|
public static Keys keyProfile = Keys.F5;
|
||||||
|
|
||||||
|
KeyHandler m1, m2, togggle;
|
||||||
|
|
||||||
public InputDispatcher(nint handle)
|
public InputDispatcher(nint handle)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -22,19 +27,39 @@ namespace GHelper
|
|||||||
if (!isOptimizationRunning) AsusUSB.RunListener(HandleEvent);
|
if (!isOptimizationRunning) AsusUSB.RunListener(HandleEvent);
|
||||||
|
|
||||||
// CTRL + SHIFT + F5 to cycle profiles
|
// CTRL + SHIFT + F5 to cycle profiles
|
||||||
Keys keybind_profile = (AppConfig.getConfig("keybind_profile") != -1) ? (Keys)AppConfig.getConfig("keybind_profile") : Keys.F5;
|
if (AppConfig.getConfig("keybind_profile") != -1) keyProfile = (Keys)AppConfig.getConfig("keybind_profile");
|
||||||
if (keybind_profile != 0)
|
|
||||||
|
togggle = new KeyHandler(KeyHandler.SHIFT | KeyHandler.CTRL, keyProfile, windowHandle);
|
||||||
|
m1 = new KeyHandler(KeyHandler.NOMOD, Keys.VolumeDown, windowHandle);
|
||||||
|
m2 = new KeyHandler(KeyHandler.NOMOD, Keys.VolumeUp, windowHandle);
|
||||||
|
|
||||||
|
RegisterKeys();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegisterKeys()
|
||||||
|
{
|
||||||
|
|
||||||
|
string actionM1 = AppConfig.getConfigString("m1");
|
||||||
|
string actionM2 = AppConfig.getConfigString("m2");
|
||||||
|
|
||||||
|
togggle.Unregiser();
|
||||||
|
m1.Unregiser();
|
||||||
|
m2.Unregiser();
|
||||||
|
|
||||||
|
if (keyProfile != Keys.None)
|
||||||
{
|
{
|
||||||
KeyHandler ghk = new KeyHandler(KeyHandler.SHIFT | KeyHandler.CTRL, keybind_profile, windowHandle);
|
togggle.Register();
|
||||||
ghk.Register();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if (actionM1 is not null && actionM1.Length > 0)
|
||||||
KeyHandler m1 = new KeyHandler(0, Keys.VolumeDown, ds);
|
{
|
||||||
m1.Register();
|
m1.Register();
|
||||||
KeyHandler m2 = new KeyHandler(0, Keys.VolumeUp, ds);
|
}
|
||||||
m2.Register();
|
|
||||||
*/
|
if (actionM2 is not null && actionM2.Length > 0)
|
||||||
|
{
|
||||||
|
m2.Register();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +85,7 @@ namespace GHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void KeyProcess(string name = "m3")
|
public static void KeyProcess(string name = "m3")
|
||||||
{
|
{
|
||||||
string action = AppConfig.getConfigString(name);
|
string action = AppConfig.getConfigString(name);
|
||||||
|
|
||||||
@@ -70,6 +95,8 @@ namespace GHelper
|
|||||||
action = "ghelper";
|
action = "ghelper";
|
||||||
if (name == "fnf4")
|
if (name == "fnf4")
|
||||||
action = "aura";
|
action = "aura";
|
||||||
|
if (name == "fnf5")
|
||||||
|
action = "performance";
|
||||||
if (name == "m3" && !isOptimizationRunning)
|
if (name == "m3" && !isOptimizationRunning)
|
||||||
action = "micmute";
|
action = "micmute";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ using System.Net;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using System.Windows.Forms;
|
|
||||||
using Tools;
|
using Tools;
|
||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
@@ -471,7 +470,7 @@ namespace GHelper
|
|||||||
|
|
||||||
if (!buttonXGM.Visible) return;
|
if (!buttonXGM.Visible) return;
|
||||||
|
|
||||||
labelTipGPU.Text = buttonXGM.Bounds.Contains(table.PointToClient(Cursor.Position)) ?
|
labelTipGPU.Text = buttonXGM.Bounds.Contains(table.PointToClient(Cursor.Position)) ?
|
||||||
"XGMobile toggle works only in Standard mode" : "";
|
"XGMobile toggle works only in Standard mode" : "";
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -517,8 +516,24 @@ namespace GHelper
|
|||||||
}
|
}
|
||||||
m.Result = (IntPtr)1;
|
m.Result = (IntPtr)1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KeyHandler.WM_HOTKEY_MSG_ID:
|
case KeyHandler.WM_HOTKEY_MSG_ID:
|
||||||
CyclePerformanceMode();
|
|
||||||
|
Keys key = (Keys)(((int)m.LParam >> 16) & 0xFFFF);
|
||||||
|
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case Keys.VolumeDown:
|
||||||
|
InputDispatcher.KeyProcess("m1");
|
||||||
|
break;
|
||||||
|
case Keys.VolumeUp:
|
||||||
|
InputDispatcher.KeyProcess("m2");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (key == InputDispatcher.keyProfile) CyclePerformanceMode();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
base.WndProc(ref m);
|
base.WndProc(ref m);
|
||||||
@@ -1384,7 +1399,8 @@ namespace GHelper
|
|||||||
ButtonEnabled(buttonEco, false);
|
ButtonEnabled(buttonEco, false);
|
||||||
ButtonEnabled(buttonStandard, false);
|
ButtonEnabled(buttonStandard, false);
|
||||||
ButtonEnabled(buttonUltimate, false);
|
ButtonEnabled(buttonUltimate, false);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
ButtonEnabled(buttonOptimized, true);
|
ButtonEnabled(buttonOptimized, true);
|
||||||
ButtonEnabled(buttonEco, true);
|
ButtonEnabled(buttonEco, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user