mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Ally Mappings
This commit is contained in:
@@ -43,38 +43,8 @@ namespace GHelper.Ally
|
||||
public const int CodeM1 = 0x028f;
|
||||
public const int CodeM2 = 0x028e;
|
||||
|
||||
private byte[] commitReset1of4 = new byte[64]
|
||||
{
|
||||
0x5A, 0xD1, 0x0F, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
|
||||
};
|
||||
|
||||
private byte[] commitReset2of4 = new byte[64]
|
||||
{
|
||||
0x5A, 0xD1, 0x06, 0x02, 0x64, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
private byte[] commitReset3of4 = new byte[64]
|
||||
{
|
||||
0x5A, 0xD1, 0x04, 0x04, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
private byte[] commitReset4of4 = new byte[64]
|
||||
{
|
||||
0x5A, 0xD1, 0x05, 0x04, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
static byte[] MappingReady = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 };
|
||||
static byte[] MappingSave = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0f, 0x20 };
|
||||
|
||||
public static Dictionary<int, string> BindingCodes = new Dictionary<int, string>
|
||||
{
|
||||
@@ -319,7 +289,7 @@ namespace GHelper.Ally
|
||||
}
|
||||
|
||||
|
||||
static private void ApplyBindings(BindingZone zone)
|
||||
static private void MappingZone(BindingZone zone)
|
||||
{
|
||||
int Key1, Key2;
|
||||
switch (zone)
|
||||
@@ -361,21 +331,26 @@ namespace GHelper.Ally
|
||||
|
||||
//AsusHid.WriteInput(Encoding.ASCII.GetBytes("ZASUS Tech.Inc."), "Init");
|
||||
|
||||
AsusHid.WriteInput(MappingReady);
|
||||
AsusHid.WriteInput(bindings, $"Bind{zone}");
|
||||
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 });
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static public void SetBindings()
|
||||
static public void SetMapping()
|
||||
{
|
||||
ApplyBindings(BindingZone.DPadUpDown);
|
||||
ApplyBindings(BindingZone.DPadLeftRight);
|
||||
ApplyBindings(BindingZone.AB);
|
||||
ApplyBindings(BindingZone.M1M2);
|
||||
ApplyBindings(BindingZone.XY);
|
||||
MappingZone(BindingZone.DPadUpDown);
|
||||
MappingZone(BindingZone.DPadLeftRight);
|
||||
MappingZone(BindingZone.StickClick);
|
||||
MappingZone(BindingZone.Bumper);
|
||||
MappingZone(BindingZone.AB);
|
||||
MappingZone(BindingZone.XY);
|
||||
MappingZone(BindingZone.ViewMenu);
|
||||
MappingZone(BindingZone.M1M2);
|
||||
MappingZone(BindingZone.Trigger);
|
||||
|
||||
AsusHid.WriteInput(MappingSave);
|
||||
|
||||
}
|
||||
|
||||
@@ -404,9 +379,11 @@ namespace GHelper.Ally
|
||||
|
||||
private void ApplyMode(ControllerMode applyMode, string log = "ControllerMode")
|
||||
{
|
||||
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 1, 1, (byte)applyMode }, log);
|
||||
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 });
|
||||
SetBindings();
|
||||
//AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0b, 0x01, (byte)applyMode }, log);
|
||||
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x01, 0x01, (byte)applyMode }, log);
|
||||
AsusHid.WriteInput(MappingSave);
|
||||
|
||||
SetMapping();
|
||||
}
|
||||
|
||||
private void SetMode(ControllerMode mode)
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace GHelper
|
||||
if (value >= 0) AppConfig.Set(combo.Name, value);
|
||||
else AppConfig.Remove(combo.Name);
|
||||
|
||||
AllyControl.SetBindings();
|
||||
AllyControl.SetMapping();
|
||||
}
|
||||
|
||||
private void Controller_Complete(object? sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user