mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Ally bindings
This commit is contained in:
@@ -3,6 +3,7 @@ using GHelper.Input;
|
|||||||
using GHelper.USB;
|
using GHelper.USB;
|
||||||
using HidSharp;
|
using HidSharp;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace GHelper.Ally
|
namespace GHelper.Ally
|
||||||
{
|
{
|
||||||
@@ -13,6 +14,7 @@ namespace GHelper.Ally
|
|||||||
Gamepad = 1,
|
Gamepad = 1,
|
||||||
WASD = 2,
|
WASD = 2,
|
||||||
Mouse = 3,
|
Mouse = 3,
|
||||||
|
Skip = -1,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum BindingZone : byte
|
public enum BindingZone : byte
|
||||||
@@ -41,40 +43,58 @@ namespace GHelper.Ally
|
|||||||
|
|
||||||
static int fpsLimit = -1;
|
static int fpsLimit = -1;
|
||||||
|
|
||||||
public const int BindA = 0x0101;
|
public const string BindA = "01-01";
|
||||||
public const int BindB = 0x0102;
|
public const string BindB = "01-02";
|
||||||
|
public const string BindX = "01-03";
|
||||||
|
public const string BindY = "01-04";
|
||||||
|
public const string BindLB = "01-05";
|
||||||
|
public const string BindRB = "01-06";
|
||||||
|
public const string BindLS = "01-07";
|
||||||
|
public const string BindRS = "01-08";
|
||||||
|
public const string BindDU = "01-09";
|
||||||
|
public const string BindDD = "01-0A";
|
||||||
|
public const string BindDL = "01-0B";
|
||||||
|
public const string BindDR = "01-0C";
|
||||||
|
public const string BindVB = "01-11";
|
||||||
|
public const string BindMB = "01-12";
|
||||||
|
public const string BindM1 = "02-8F";
|
||||||
|
public const string BindM2 = "02-8E";
|
||||||
|
public const string BindLT = "01-0D";
|
||||||
|
public const string BindRT = "01-0E";
|
||||||
|
public const string BindMouseL = "03-01";
|
||||||
|
public const string BindMouseR = "03-02";
|
||||||
|
|
||||||
public const int BindX = 0x0103;
|
public const string BindKBU = "02-98";
|
||||||
public const int BindY = 0x0104;
|
public const string BindKBD = "02-99";
|
||||||
|
public const string BindKBL = "02-91";
|
||||||
|
public const string BindKBR = "02-9D";
|
||||||
|
|
||||||
public const int BindLB = 0x0105;
|
public const string BindTab = "02-0D";
|
||||||
public const int BindRB = 0x0106;
|
public const string BindEnter = "02-5A";
|
||||||
|
public const string BindBack = "02-66";
|
||||||
|
|
||||||
public const int BindLS = 0x0107;
|
public const string BindPgU = "02-96";
|
||||||
public const int BindRS = 0x0108;
|
public const string BindPgD = "02-97";
|
||||||
|
|
||||||
public const int BindDU = 0x0109;
|
public const string BindShift = "02-88";
|
||||||
public const int BindDD = 0x010A;
|
public const string BindCtrl = "02-8C";
|
||||||
|
|
||||||
public const int BindDL = 0x010B;
|
public const string BindTaskManager = "04-03-8C-88-76";
|
||||||
public const int BindDR = 0x010C;
|
public const string BindCloseWindow = "04-02-8A-0C";
|
||||||
|
|
||||||
public const int BindVB = 0x0111;
|
public const string BindBrightnessDown = "04-04-8C-88-8A-05";
|
||||||
public const int BindMB = 0x0112;
|
public const string BindBrightnessUp = "04-04-8C-88-8A-06";
|
||||||
|
|
||||||
public const int BindM1 = 0x028f;
|
public const string BindOverlay = "04-03-8C-88-44";
|
||||||
public const int BindM2 = 0x028e;
|
|
||||||
|
|
||||||
public const int BindLT = 0x010d;
|
|
||||||
public const int BindRT = 0x010e;
|
|
||||||
|
|
||||||
static byte[] CommandReady = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 };
|
static byte[] CommandReady = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 };
|
||||||
static byte[] CommandSave = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0f, 0x20 };
|
static byte[] CommandSave = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0f, 0x20 };
|
||||||
|
|
||||||
public static Dictionary<int, string> BindCodes = new Dictionary<int, string>
|
public static Dictionary<string, string> BindCodes = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ -1, "--------" },
|
{ "", "--------" },
|
||||||
{ 0x0000, "[ Disabled ]" },
|
{ "00-00", "[ Disabled ]" },
|
||||||
|
|
||||||
{ BindM1, "M1" },
|
{ BindM1, "M1" },
|
||||||
{ BindM2, "M2" },
|
{ BindM2, "M2" },
|
||||||
@@ -100,122 +120,128 @@ namespace GHelper.Ally
|
|||||||
{ BindVB, "View Button" },
|
{ BindVB, "View Button" },
|
||||||
{ BindMB, "Menu Button" },
|
{ BindMB, "Menu Button" },
|
||||||
|
|
||||||
{ 0x0113, "XBox/Steam" },
|
{ "01-13", "XBox/Steam" },
|
||||||
|
|
||||||
{ 0x0276, "Esc" },
|
{ "02-76", "Esc" },
|
||||||
{ 0x0250, "F1" },
|
{ "02-05", "F1" },
|
||||||
{ 0x0260, "F2" },
|
{ "02-06", "F2" },
|
||||||
{ 0x0240, "F3" },
|
{ "02-04", "F3" },
|
||||||
{ 0x020C, "F4" },
|
{ "02-0C", "F4" },
|
||||||
{ 0x0203, "F5" },
|
{ "02-03", "F5" },
|
||||||
{ 0x020b, "F6" },
|
{ "02-0B", "F6" },
|
||||||
{ 0x0280, "F7" },
|
{ "02-80", "F7" },
|
||||||
{ 0x020a, "F8" },
|
{ "02-0A", "F8" },
|
||||||
{ 0x0201, "F9" },
|
{ "02-01", "F9" },
|
||||||
{ 0x0209, "F10" },
|
{ "02-09", "F10" },
|
||||||
{ 0x0278, "F11" },
|
{ "02-78", "F11" },
|
||||||
{ 0x0207, "F12" },
|
{ "02-07", "F12" },
|
||||||
{ 0x020E, "`" },
|
{ "02-0E", "`" },
|
||||||
{ 0x0216, "1" },
|
{ "02-16", "1" },
|
||||||
{ 0x021E, "2" },
|
{ "02-1E", "2" },
|
||||||
{ 0x0226, "3" },
|
{ "02-26", "3" },
|
||||||
{ 0x0225, "4" },
|
{ "02-25", "4" },
|
||||||
{ 0x022E, "5" },
|
{ "02-2E", "5" },
|
||||||
{ 0x0236, "6" },
|
{ "02-36", "6" },
|
||||||
{ 0x023D, "7" },
|
{ "02-3D", "7" },
|
||||||
{ 0x023E, "8" },
|
{ "02-3E", "8" },
|
||||||
{ 0x0246, "9" },
|
{ "02-46", "9" },
|
||||||
{ 0x0245, "0" },
|
{ "02-45", "0" },
|
||||||
{ 0x024E, "-" },
|
{ "02-4E", "-" },
|
||||||
{ 0x0255, "=" },
|
{ "02-55", "=" },
|
||||||
{ 0x0266, "Backspace" },
|
{ BindBack, "Backspace" },
|
||||||
{ 0x020D, "Tab" },
|
{ BindTab, "Tab" },
|
||||||
{ 0x0215, "Q" },
|
{ "02-15", "Q" },
|
||||||
{ 0x021D, "W" },
|
{ "02-1D", "W" },
|
||||||
{ 0x0224, "E" },
|
{ "02-24", "E" },
|
||||||
{ 0x022D, "R" },
|
{ "02-2D", "R" },
|
||||||
{ 0x022C, "T" },
|
{ "02-2C", "T" },
|
||||||
{ 0x0235, "Y" },
|
{ "02-35", "Y" },
|
||||||
{ 0x023C, "U" },
|
{ "02-3C", "U" },
|
||||||
{ 0x0244, "O" },
|
{ "02-44", "O" },
|
||||||
{ 0x024D, "P" },
|
{ "02-4D", "P" },
|
||||||
{ 0x0254, "[" },
|
{ "02-54", "[" },
|
||||||
{ 0x025B, "]" },
|
{ "02-5B", "]" },
|
||||||
{ 0x025D, "|" },
|
{ "02-5D", "|" },
|
||||||
{ 0x0258, "Caps" },
|
{ "02-58", "Caps" },
|
||||||
{ 0x021C, "A" },
|
{ "02-1C", "A" },
|
||||||
{ 0x021B, "S" },
|
{ "02-1B", "S" },
|
||||||
{ 0x0223, "D" },
|
{ "02-23", "D" },
|
||||||
{ 0x022B, "F" },
|
{ "02-2B", "F" },
|
||||||
{ 0x0234, "G" },
|
{ "02-34", "G" },
|
||||||
{ 0x0233, "H" },
|
{ "02-33", "H" },
|
||||||
{ 0x023B, "J" },
|
{ "02-3B", "J" },
|
||||||
{ 0x0242, "k" },
|
{ "02-42", "k" },
|
||||||
{ 0x024b, "l" },
|
{ "02-4B", "l" },
|
||||||
{ 0x024c, ";" },
|
{ "02-4C", ";" },
|
||||||
{ 0x0252, "'" },
|
{ "02-52", "'" },
|
||||||
{ 0x025A, "Enter" },
|
{ BindEnter, "Enter" },
|
||||||
{ 0x0288, "LShift" },
|
{ BindShift, "LShift" },
|
||||||
{ 0x0222, "X" },
|
{ "02-22", "X" },
|
||||||
{ 0x021A, "Z" },
|
{ "02-1A", "Z" },
|
||||||
{ 0x0221, "C" },
|
{ "02-21", "C" },
|
||||||
{ 0x022A, "V" },
|
{ "02-2A", "V" },
|
||||||
{ 0x0232, "B" },
|
{ "02-32", "B" },
|
||||||
{ 0x0231, "N" },
|
{ "02-31", "N" },
|
||||||
{ 0x023A, "M" },
|
{ "02-3A", "M" },
|
||||||
{ 0x0241, "," },
|
{ "02-41", "," },
|
||||||
{ 0x0249, "." },
|
{ "02-49", "." },
|
||||||
{ 0x0289, "RShift" },
|
{ "02-89", "RShift" },
|
||||||
{ 0x028C, "LCtl" },
|
{ BindCtrl, "LCtl" },
|
||||||
{ 0x0282, "Meta" },
|
{ "02-82", "Meta" },
|
||||||
{ 0x028A, "LAlt" },
|
{ "02-8A", "LAlt" },
|
||||||
{ 0x0229, "Space" },
|
{ "02-29", "Space" },
|
||||||
{ 0x028B, "RAlt" },
|
{ "02-8B", "RAlt" },
|
||||||
{ 0x0284, "App menu" },
|
{ "02-84", "App menu" },
|
||||||
{ 0x028D, "RCtl" },
|
{ "02-8D", "RCtl" },
|
||||||
{ 0x02C3, "PrntScn" },
|
{ "02-C3", "PrntScn" },
|
||||||
{ 0x027E, "ScrLk" },
|
{ "02-7E", "ScrLk" },
|
||||||
{ 0x02C2, "Insert" },
|
{ "02-C2", "Insert" },
|
||||||
{ 0x0294, "Home" },
|
{ BindPgU, "PgUp" },
|
||||||
{ 0x0296, "PgUp" },
|
{ BindPgD, "PgDwn" },
|
||||||
{ 0x02C0, "Delete" },
|
{ "02-C0", "Delete" },
|
||||||
{ 0x0295, "End" },
|
{ "02-94", "Home" },
|
||||||
{ 0x0297, "PgDwn" },
|
{ "02-95", "End" },
|
||||||
{ 0x0298, "UpArrow" },
|
{ BindKBU, "UpArrow" },
|
||||||
{ 0x0299, "DownArrow" },
|
{ BindKBD, "DownArrow" },
|
||||||
{ 0x0291, "LeftArrow" },
|
{ BindKBL, "LeftArrow" },
|
||||||
{ 0x029B, "RightArrow" },
|
{ BindKBR, "RightArrow" },
|
||||||
{ 0x0277, "NumLock" },
|
{ "02-77", "NumLock" },
|
||||||
{ 0x0290, "NumSlash" },
|
{ "02-90", "NumSlash" },
|
||||||
{ 0x027C, "NumStar" },
|
{ "02-7C", "NumStar" },
|
||||||
{ 0x027B, "NumHyphen" },
|
{ "02-7B", "NumHyphen" },
|
||||||
{ 0x0270, "Num0" },
|
{ "02-70", "Num0" },
|
||||||
{ 0x0269, "Num1" },
|
{ "02-69", "Num1" },
|
||||||
{ 0x0272, "Num2" },
|
{ "02-72", "Num2" },
|
||||||
{ 0x027A, "Num3" },
|
{ "02-7A", "Num3" },
|
||||||
{ 0x026B, "Num4" },
|
{ "02-6B", "Num4" },
|
||||||
{ 0x0273, "Num5" },
|
{ "02-73", "Num5" },
|
||||||
{ 0x0274, "Num6" },
|
{ "02-74", "Num6" },
|
||||||
{ 0x026C, "Num7" },
|
{ "02-6C", "Num7" },
|
||||||
{ 0x0275, "Num8" },
|
{ "02-75", "Num8" },
|
||||||
{ 0x027D, "Num9" },
|
{ "02-7D", "Num9" },
|
||||||
{ 0x0279, "NumPlus" },
|
{ "02-79", "NumPlus" },
|
||||||
{ 0x0281, "NumEnter" },
|
{ "02-81", "NumEnter" },
|
||||||
{ 0x0271, "NumPeriod" },
|
{ "02-71", "NumPeriod" },
|
||||||
|
|
||||||
{ 0x0301, "Mouse left click" },
|
{ BindMouseL, "Mouse left click" },
|
||||||
{ 0x0302, "Mouse right click" },
|
{ BindMouseR, "Mouse right click" },
|
||||||
{ 0x0303, "Mouse middle click" },
|
{ "03-03", "Mouse middle click" },
|
||||||
{ 0x0304, "Mouse scroll up" },
|
{ "03-04", "Mouse scroll up" },
|
||||||
{ 0x0305, "Mouse scroll down" },
|
{ "03-05", "Mouse scroll down" },
|
||||||
|
|
||||||
{ 0x0516, "Screenshot" },
|
{ BindTaskManager, "Task Manager" },
|
||||||
{ 0x0519, "Show keyboard" },
|
{ BindCloseWindow, "Close Window" },
|
||||||
{ 0x051c, "Show desktop" },
|
|
||||||
{ 0x051e, "Begin recording" },
|
{ "05-16", "Screenshot" },
|
||||||
{ 0x0501, "Mic off" },
|
{ "05-19", "Show keyboard" },
|
||||||
{ 0x0502, "Vol Down" },
|
{ "05-1C", "Show desktop" },
|
||||||
{ 0x0503, "Vol Up" }
|
{ "05-1E", "Begin recording" },
|
||||||
|
{ "05-01", "Mic off" },
|
||||||
|
|
||||||
|
{ "05-03", "Vol Up" },
|
||||||
|
{ "05-02", "Vol Down" },
|
||||||
|
{ BindBrightnessUp, "Bright Up" },
|
||||||
|
{ BindBrightnessDown, "Bright Down" }
|
||||||
};
|
};
|
||||||
|
|
||||||
public AllyControl(SettingsForm settingsForm)
|
public AllyControl(SettingsForm settingsForm)
|
||||||
@@ -293,29 +319,39 @@ namespace GHelper.Ally
|
|||||||
settings.VisualiseBacklight(InputDispatcher.GetBacklight());
|
settings.VisualiseBacklight(InputDispatcher.GetBacklight());
|
||||||
}
|
}
|
||||||
|
|
||||||
static private byte[] DecodeBinding(int binding)
|
static private byte[] DecodeBinding(string binding = "")
|
||||||
{
|
{
|
||||||
|
byte[] bytes;
|
||||||
|
|
||||||
if (binding < 0) return new byte[2];
|
if (binding == "" || binding is null) return new byte[2];
|
||||||
|
|
||||||
byte command = (byte)(binding & 0xFF);
|
try
|
||||||
byte device = (byte)((binding >> 8) & 0xFF);
|
{
|
||||||
|
bytes = AppConfig.StringToBytes(binding);
|
||||||
|
} catch
|
||||||
|
{
|
||||||
|
return new byte[2];
|
||||||
|
}
|
||||||
|
|
||||||
byte[] code = new byte[10];
|
byte[] code = new byte[10];
|
||||||
code[0] = device;
|
code[0] = bytes[0];
|
||||||
switch (device)
|
|
||||||
|
switch (bytes[0])
|
||||||
{
|
{
|
||||||
case 0x02:
|
case 0x02:
|
||||||
code[2] = command;
|
code[2] = bytes[1];
|
||||||
break;
|
break;
|
||||||
case 0x03:
|
case 0x03:
|
||||||
code[4] = command;
|
code[4] = bytes[1];
|
||||||
|
break;
|
||||||
|
case 0x04:
|
||||||
|
bytes.Skip(1).ToArray().CopyTo(code, 5);
|
||||||
break;
|
break;
|
||||||
case 0x05:
|
case 0x05:
|
||||||
code[3] = command;
|
code[3] = bytes[1];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
code[1] = command;
|
code[1] = bytes[1];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,70 +360,72 @@ namespace GHelper.Ally
|
|||||||
|
|
||||||
static private void BindZone(BindingZone zone)
|
static private void BindZone(BindingZone zone)
|
||||||
{
|
{
|
||||||
int KeyL1, KeyR1;
|
string KeyL1, KeyR1;
|
||||||
int KeyL2, KeyR2;
|
string KeyL2, KeyR2;
|
||||||
|
|
||||||
|
bool desktop = (_applyMode == ControllerMode.Mouse);
|
||||||
|
|
||||||
switch (zone)
|
switch (zone)
|
||||||
{
|
{
|
||||||
case BindingZone.DPadUpDown:
|
case BindingZone.DPadUpDown:
|
||||||
KeyL1 = AppConfig.Get("bind_du", BindDU);
|
KeyL1 = AppConfig.GetString("bind_du", desktop ? BindKBU : BindDU);
|
||||||
KeyR1 = AppConfig.Get("bind_dd", BindDD);
|
KeyR1 = AppConfig.GetString("bind_dd", desktop ? BindKBD : BindDD);
|
||||||
KeyL2 = AppConfig.Get("bind2_du");
|
KeyL2 = AppConfig.GetString("bind2_du", BindBrightnessUp);
|
||||||
KeyR2 = AppConfig.Get("bind2_dd");
|
KeyR2 = AppConfig.GetString("bind2_dd", BindBrightnessDown);
|
||||||
break;
|
break;
|
||||||
case BindingZone.DPadLeftRight:
|
case BindingZone.DPadLeftRight:
|
||||||
KeyL1 = AppConfig.Get("bind_dl", BindDL);
|
KeyL1 = AppConfig.GetString("bind_dl", desktop ? BindKBL : BindDL);
|
||||||
KeyR1 = AppConfig.Get("bind_dr", BindDR);
|
KeyR1 = AppConfig.GetString("bind_dr", desktop ? BindKBR : BindDR);
|
||||||
KeyL2 = AppConfig.Get("bind2_dl");
|
KeyL2 = AppConfig.GetString("bind2_dl");
|
||||||
KeyR2 = AppConfig.Get("bind2_dr");
|
KeyR2 = AppConfig.GetString("bind2_dr");
|
||||||
break;
|
break;
|
||||||
case BindingZone.StickClick:
|
case BindingZone.StickClick:
|
||||||
KeyL1 = AppConfig.Get("bind_ls", BindLS);
|
KeyL1 = AppConfig.GetString("bind_ls", desktop ? BindShift : BindLS);
|
||||||
KeyR1 = AppConfig.Get("bind_rs", BindRS);
|
KeyR1 = AppConfig.GetString("bind_rs", desktop ? BindMouseL : BindRS);
|
||||||
KeyL2 = AppConfig.Get("bind2_ls");
|
KeyL2 = AppConfig.GetString("bind2_ls");
|
||||||
KeyR2 = AppConfig.Get("bind2_rs");
|
KeyR2 = AppConfig.GetString("bind2_rs");
|
||||||
break;
|
break;
|
||||||
case BindingZone.Bumper:
|
case BindingZone.Bumper:
|
||||||
KeyL1 = AppConfig.Get("bind_lb", BindLB);
|
KeyL1 = AppConfig.GetString("bind_lb", desktop ? BindTab : BindLB);
|
||||||
KeyR1 = AppConfig.Get("bind_rb", BindRB);
|
KeyR1 = AppConfig.GetString("bind_rb", desktop ? BindMouseL : BindRB);
|
||||||
KeyL2 = AppConfig.Get("bind2_lb");
|
KeyL2 = AppConfig.GetString("bind2_lb");
|
||||||
KeyR2 = AppConfig.Get("bind2_rb");
|
KeyR2 = AppConfig.GetString("bind2_rb");
|
||||||
break;
|
break;
|
||||||
case BindingZone.AB:
|
case BindingZone.AB:
|
||||||
KeyL1 = AppConfig.Get("bind_a", BindA);
|
KeyL1 = AppConfig.GetString("bind_a", desktop ? BindEnter : BindA);
|
||||||
KeyR1 = AppConfig.Get("bind_b", BindB);
|
KeyR1 = AppConfig.GetString("bind_b", desktop ? BindBack : BindB);
|
||||||
KeyL2 = AppConfig.Get("bind2_a");
|
KeyL2 = AppConfig.GetString("bind2_a");
|
||||||
KeyR2 = AppConfig.Get("bind2_b");
|
KeyR2 = AppConfig.GetString("bind2_b");
|
||||||
break;
|
break;
|
||||||
case BindingZone.XY:
|
case BindingZone.XY:
|
||||||
KeyL1 = AppConfig.Get("bind_x", BindX);
|
KeyL1 = AppConfig.GetString("bind_x", desktop ? BindPgD : BindX);
|
||||||
KeyR1 = AppConfig.Get("bind_y", BindY);
|
KeyR1 = AppConfig.GetString("bind_y", desktop ? BindPgU : BindY);
|
||||||
KeyL2 = AppConfig.Get("bind2_x");
|
KeyL2 = AppConfig.GetString("bind2_x");
|
||||||
KeyR2 = AppConfig.Get("bind2_y");
|
KeyR2 = AppConfig.GetString("bind2_y", BindOverlay);
|
||||||
break;
|
break;
|
||||||
case BindingZone.ViewMenu:
|
case BindingZone.ViewMenu:
|
||||||
KeyL1 = AppConfig.Get("bind_vb", BindVB);
|
KeyL1 = AppConfig.GetString("bind_vb", BindVB);
|
||||||
KeyR1 = AppConfig.Get("bind_mb", BindMB);
|
KeyR1 = AppConfig.GetString("bind_mb", BindMB);
|
||||||
KeyL2 = AppConfig.Get("bind2_vb");
|
KeyL2 = AppConfig.GetString("bind2_vb");
|
||||||
KeyR2 = AppConfig.Get("bind2_mb");
|
KeyR2 = AppConfig.GetString("bind2_mb", BindCloseWindow);
|
||||||
break;
|
break;
|
||||||
case BindingZone.M1M2:
|
case BindingZone.M1M2:
|
||||||
KeyL1 = AppConfig.Get("bind_m2", BindM2);
|
KeyL1 = AppConfig.GetString("bind_m2", BindM2);
|
||||||
KeyR1 = AppConfig.Get("bind_m1", BindM1);
|
KeyR1 = AppConfig.GetString("bind_m1", BindM1);
|
||||||
KeyL2 = AppConfig.Get("bind2_m2", BindM2);
|
KeyL2 = AppConfig.GetString("bind2_m2", BindM2);
|
||||||
KeyR2 = AppConfig.Get("bind2_m1", BindM1);
|
KeyR2 = AppConfig.GetString("bind2_m1", BindM1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
KeyL1 = AppConfig.Get("bind_trl", BindLT);
|
KeyL1 = AppConfig.GetString("bind_trl", desktop ? BindCtrl : BindLT);
|
||||||
KeyR1 = AppConfig.Get("bind_trr", BindRT);
|
KeyR1 = AppConfig.GetString("bind_trr", desktop ? BindMouseR : BindRT);
|
||||||
KeyL2 = AppConfig.Get("bind2_trl");
|
KeyL2 = AppConfig.GetString("bind2_trl");
|
||||||
KeyR2 = AppConfig.Get("bind2_trr");
|
KeyR2 = AppConfig.GetString("bind2_trr");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KeyL1 == -1 && KeyR1 == -1) return;
|
if (KeyL1 == "" && KeyR1 == "") return;
|
||||||
|
|
||||||
byte[] bindings = new byte[64];
|
byte[] bindings = new byte[50];
|
||||||
byte[] init = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x02, (byte)zone, 0x2c };
|
byte[] init = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x02, (byte)zone, 0x2c };
|
||||||
|
|
||||||
init.CopyTo(bindings, 0);
|
init.CopyTo(bindings, 0);
|
||||||
@@ -399,7 +437,7 @@ namespace GHelper.Ally
|
|||||||
DecodeBinding(KeyR2).CopyTo(bindings, 38);
|
DecodeBinding(KeyR2).CopyTo(bindings, 38);
|
||||||
|
|
||||||
AsusHid.WriteInput(CommandReady, null);
|
AsusHid.WriteInput(CommandReady, null);
|
||||||
AsusHid.WriteInput(bindings, $"Bind{zone}");
|
AsusHid.WriteInput(bindings, $"B{zone}");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -437,7 +475,10 @@ namespace GHelper.Ally
|
|||||||
|
|
||||||
public static void ApplyMode(ControllerMode applyMode = ControllerMode.Auto)
|
public static void ApplyMode(ControllerMode applyMode = ControllerMode.Auto)
|
||||||
{
|
{
|
||||||
Task.Run(() => {
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
|
||||||
|
if (applyMode == ControllerMode.Skip) return;
|
||||||
|
|
||||||
HidStream? input = AsusHid.FindHidStream(AsusHid.INPUT_ID);
|
HidStream? input = AsusHid.FindHidStream(AsusHid.INPUT_ID);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -456,6 +497,7 @@ namespace GHelper.Ally
|
|||||||
|
|
||||||
if (applyMode != ControllerMode.Auto) _applyMode = applyMode;
|
if (applyMode != ControllerMode.Auto) _applyMode = applyMode;
|
||||||
|
|
||||||
|
InputDispatcher.SetBacklightAuto(true);
|
||||||
WakeUp();
|
WakeUp();
|
||||||
|
|
||||||
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x01, 0x01, (byte)_applyMode }, "Controller");
|
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x01, 0x01, (byte)_applyMode }, "Controller");
|
||||||
@@ -463,20 +505,18 @@ namespace GHelper.Ally
|
|||||||
|
|
||||||
BindZone(BindingZone.M1M2);
|
BindZone(BindingZone.M1M2);
|
||||||
|
|
||||||
if (_applyMode == ControllerMode.Gamepad)
|
BindZone(BindingZone.DPadUpDown);
|
||||||
{
|
BindZone(BindingZone.DPadLeftRight);
|
||||||
BindZone(BindingZone.DPadUpDown);
|
BindZone(BindingZone.StickClick);
|
||||||
BindZone(BindingZone.DPadLeftRight);
|
BindZone(BindingZone.Bumper);
|
||||||
BindZone(BindingZone.StickClick);
|
BindZone(BindingZone.AB);
|
||||||
BindZone(BindingZone.Bumper);
|
BindZone(BindingZone.XY);
|
||||||
BindZone(BindingZone.AB);
|
BindZone(BindingZone.ViewMenu);
|
||||||
BindZone(BindingZone.XY);
|
BindZone(BindingZone.Trigger);
|
||||||
BindZone(BindingZone.ViewMenu);
|
|
||||||
BindZone(BindingZone.Trigger);
|
|
||||||
}
|
|
||||||
|
|
||||||
AsusHid.WriteInput(CommandSave, null);
|
AsusHid.WriteInput(CommandSave, null);
|
||||||
SetDeadzones();
|
SetDeadzones();
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -484,9 +524,10 @@ namespace GHelper.Ally
|
|||||||
{
|
{
|
||||||
|
|
||||||
_mode = mode;
|
_mode = mode;
|
||||||
ApplyMode(mode);
|
|
||||||
AppConfig.Set("controller_mode", (int)mode);
|
AppConfig.Set("controller_mode", (int)mode);
|
||||||
|
|
||||||
|
ApplyMode(mode);
|
||||||
|
|
||||||
if (mode == ControllerMode.Auto)
|
if (mode == ControllerMode.Auto)
|
||||||
{
|
{
|
||||||
amdControl.StartFPS();
|
amdControl.StartFPS();
|
||||||
@@ -497,7 +538,7 @@ namespace GHelper.Ally
|
|||||||
timer.Stop();
|
timer.Stop();
|
||||||
amdControl.StopFPS();
|
amdControl.StopFPS();
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.VisualiseController(mode);
|
settings.VisualiseController(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,6 +554,9 @@ namespace GHelper.Ally
|
|||||||
SetMode(ControllerMode.Mouse);
|
SetMode(ControllerMode.Mouse);
|
||||||
break;
|
break;
|
||||||
case ControllerMode.Mouse:
|
case ControllerMode.Mouse:
|
||||||
|
SetMode(ControllerMode.Skip);
|
||||||
|
break;
|
||||||
|
case ControllerMode.Skip:
|
||||||
SetMode(ControllerMode.Auto);
|
SetMode(ControllerMode.Auto);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.148</AssemblyVersion>
|
<AssemblyVersion>0.149</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
4
app/Handheld.Designer.cs
generated
4
app/Handheld.Designer.cs
generated
@@ -640,9 +640,9 @@
|
|||||||
labelBindings.Location = new Point(45, 17);
|
labelBindings.Location = new Point(45, 17);
|
||||||
labelBindings.Margin = new Padding(4, 0, 4, 0);
|
labelBindings.Margin = new Padding(4, 0, 4, 0);
|
||||||
labelBindings.Name = "labelBindings";
|
labelBindings.Name = "labelBindings";
|
||||||
labelBindings.Size = new Size(558, 32);
|
labelBindings.Size = new Size(114, 32);
|
||||||
labelBindings.TabIndex = 40;
|
labelBindings.TabIndex = 40;
|
||||||
labelBindings.Text = "Bindings for Gamepad or Auto (in-game) Mode";
|
labelBindings.Text = "Bindings";
|
||||||
//
|
//
|
||||||
// Handheld
|
// Handheld
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ namespace GHelper
|
|||||||
|
|
||||||
trackVibra.ValueChanged += Controller_Complete;
|
trackVibra.ValueChanged += Controller_Complete;
|
||||||
|
|
||||||
FillBinding("m1", "M1", AllyControl.BindM1);
|
FillBinding("m1", "M1");
|
||||||
FillBinding("m2", "M2", AllyControl.BindM2);
|
FillBinding("m2", "M2");
|
||||||
|
|
||||||
FillBinding("a", "A");
|
FillBinding("a", "A");
|
||||||
FillBinding("b", "B");
|
FillBinding("b", "B");
|
||||||
@@ -65,7 +65,7 @@ namespace GHelper
|
|||||||
FillBinding("mb", "Menu");
|
FillBinding("mb", "Menu");
|
||||||
}
|
}
|
||||||
|
|
||||||
private RComboBox ComboBinding(string name, int value)
|
private RComboBox ComboBinding(string name, string value)
|
||||||
{
|
{
|
||||||
var combo = new RComboBox();
|
var combo = new RComboBox();
|
||||||
combo.BorderColor = Color.White;
|
combo.BorderColor = Color.White;
|
||||||
@@ -79,7 +79,7 @@ namespace GHelper
|
|||||||
combo.ValueMember = "Key";
|
combo.ValueMember = "Key";
|
||||||
foreach (var item in AllyControl.BindCodes)
|
foreach (var item in AllyControl.BindCodes)
|
||||||
{
|
{
|
||||||
combo.Items.Add(new KeyValuePair<int, string>(item.Key, item.Value));
|
combo.Items.Add(new KeyValuePair<string, string>(item.Key, item.Value));
|
||||||
if (item.Key == value) combo.SelectedItem = item;
|
if (item.Key == value) combo.SelectedItem = item;
|
||||||
}
|
}
|
||||||
combo.SelectedValueChanged += Binding_SelectedValueChanged;
|
combo.SelectedValueChanged += Binding_SelectedValueChanged;
|
||||||
@@ -89,13 +89,13 @@ namespace GHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void FillBinding(string binding, string label, int defaultValue = -1)
|
private void FillBinding(string binding, string label)
|
||||||
{
|
{
|
||||||
tableBindings.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
tableBindings.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
||||||
tableBindings.Controls.Add(new Label { Text = label, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 0, tableBindings.RowCount);
|
tableBindings.Controls.Add(new Label { Text = label, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 0, tableBindings.RowCount);
|
||||||
|
|
||||||
tableBindings.Controls.Add(ComboBinding("bind_" + binding, AppConfig.Get("bind_" + binding, defaultValue)), 1, tableBindings.RowCount);
|
tableBindings.Controls.Add(ComboBinding("bind_" + binding, AppConfig.GetString("bind_" + binding, "")), 1, tableBindings.RowCount);
|
||||||
tableBindings.Controls.Add(ComboBinding("bind2_" + binding, AppConfig.Get("bind2_" + binding)), 2, tableBindings.RowCount);
|
tableBindings.Controls.Add(ComboBinding("bind2_" + binding, AppConfig.GetString("bind2_" + binding, "")), 2, tableBindings.RowCount);
|
||||||
|
|
||||||
tableBindings.RowCount++;
|
tableBindings.RowCount++;
|
||||||
|
|
||||||
@@ -107,9 +107,9 @@ namespace GHelper
|
|||||||
if (sender is null) return;
|
if (sender is null) return;
|
||||||
RComboBox combo = (RComboBox)sender;
|
RComboBox combo = (RComboBox)sender;
|
||||||
|
|
||||||
int value = ((KeyValuePair<int, string>)combo.SelectedItem).Key;
|
string value = ((KeyValuePair<string, string>)combo.SelectedItem).Key;
|
||||||
|
|
||||||
if (value >= 0) AppConfig.Set(combo.Name, value);
|
if (value != "") AppConfig.Set(combo.Name, value);
|
||||||
else AppConfig.Remove(combo.Name);
|
else AppConfig.Remove(combo.Name);
|
||||||
|
|
||||||
AllyControl.ApplyMode();
|
AllyControl.ApplyMode();
|
||||||
|
|||||||
@@ -118,7 +118,6 @@ namespace GHelper.Input
|
|||||||
|
|
||||||
if (!AppConfig.Is("skip_hotkeys"))
|
if (!AppConfig.Is("skip_hotkeys"))
|
||||||
{
|
{
|
||||||
|
|
||||||
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F14);
|
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F14);
|
||||||
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F15);
|
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F15);
|
||||||
|
|
||||||
@@ -142,6 +141,12 @@ namespace GHelper.Input
|
|||||||
if (actionM2 is not null && actionM2.Length > 0) hook.RegisterHotKey(ModifierKeys.None, Keys.VolumeUp);
|
if (actionM2 is not null && actionM2.Length > 0) hook.RegisterHotKey(ModifierKeys.None, Keys.VolumeUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (AppConfig.IsAlly())
|
||||||
|
{
|
||||||
|
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F1);
|
||||||
|
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F2);
|
||||||
|
}
|
||||||
|
|
||||||
// FN-Lock group
|
// FN-Lock group
|
||||||
|
|
||||||
if (AppConfig.Is("fn_lock") && !AppConfig.ContainsModel("VivoBook"))
|
if (AppConfig.Is("fn_lock") && !AppConfig.ContainsModel("VivoBook"))
|
||||||
@@ -359,6 +364,12 @@ namespace GHelper.Input
|
|||||||
|
|
||||||
switch (e.Key)
|
switch (e.Key)
|
||||||
{
|
{
|
||||||
|
case Keys.F1:
|
||||||
|
SetBrightness(-10);
|
||||||
|
break;
|
||||||
|
case Keys.F2:
|
||||||
|
SetBrightness(10);
|
||||||
|
break;
|
||||||
case Keys.F14:
|
case Keys.F14:
|
||||||
Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco);
|
Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -305,6 +305,9 @@ namespace GHelper
|
|||||||
case ControllerMode.Mouse:
|
case ControllerMode.Mouse:
|
||||||
buttonControllerMode.Text = "Mouse";
|
buttonControllerMode.Text = "Mouse";
|
||||||
break;
|
break;
|
||||||
|
case ControllerMode.Skip:
|
||||||
|
buttonControllerMode.Text = "Skip";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
buttonControllerMode.Text = "Auto";
|
buttonControllerMode.Text = "Auto";
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using System.Runtime.InteropServices;
|
|||||||
|
|
||||||
namespace GHelper.UI
|
namespace GHelper.UI
|
||||||
{
|
{
|
||||||
|
|
||||||
public class RForm : Form
|
public class RForm : Form
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -22,6 +21,19 @@ namespace GHelper.UI
|
|||||||
public static Color chartMain;
|
public static Color chartMain;
|
||||||
public static Color chartGrid;
|
public static Color chartGrid;
|
||||||
|
|
||||||
|
static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
|
||||||
|
static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2);
|
||||||
|
static readonly IntPtr HWND_TOP = new IntPtr(0);
|
||||||
|
static readonly IntPtr HWND_BOTTOM = new IntPtr(1);
|
||||||
|
const UInt32 SWP_NOSIZE = 0x0001;
|
||||||
|
const UInt32 SWP_NOMOVE = 0x0002;
|
||||||
|
const UInt32 TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE;
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
|
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
|
||||||
|
protected override bool ShowWithoutActivation => true;
|
||||||
|
|
||||||
[DllImport("UXTheme.dll", SetLastError = true, EntryPoint = "#138")]
|
[DllImport("UXTheme.dll", SetLastError = true, EntryPoint = "#138")]
|
||||||
public static extern bool CheckSystemDarkModeStatus();
|
public static extern bool CheckSystemDarkModeStatus();
|
||||||
|
|
||||||
@@ -110,6 +110,7 @@ namespace GHelper.USB
|
|||||||
{ AuraMode.AuraStatic, Properties.Strings.AuraStatic },
|
{ AuraMode.AuraStatic, Properties.Strings.AuraStatic },
|
||||||
{ AuraMode.AuraBreathe, Properties.Strings.AuraBreathe },
|
{ AuraMode.AuraBreathe, Properties.Strings.AuraBreathe },
|
||||||
{ AuraMode.AuraColorCycle, Properties.Strings.AuraColorCycle },
|
{ AuraMode.AuraColorCycle, Properties.Strings.AuraColorCycle },
|
||||||
|
{ AuraMode.AuraRainbow, Properties.Strings.AuraRainbow },
|
||||||
{ AuraMode.AuraStrobe, Properties.Strings.AuraStrobe },
|
{ AuraMode.AuraStrobe, Properties.Strings.AuraStrobe },
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -263,9 +264,10 @@ namespace GHelper.USB
|
|||||||
new byte[] { AsusHid.AURA_ID, 0xb9 },
|
new byte[] { AsusHid.AURA_ID, 0xb9 },
|
||||||
Encoding.ASCII.GetBytes("]ASUS Tech.Inc."),
|
Encoding.ASCII.GetBytes("]ASUS Tech.Inc."),
|
||||||
new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1a },
|
new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1a },
|
||||||
//Encoding.ASCII.GetBytes("^ASUS Tech.Inc."),
|
|
||||||
//new byte[] { 0x5e, 0x05, 0x20, 0x31, 0, 0x1a }
|
|
||||||
}, "Init");
|
}, "Init");
|
||||||
|
|
||||||
|
AsusHid.WriteInput(Encoding.ASCII.GetBytes("ZASUS Tech.Inc."));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user