Ally Mappings

This commit is contained in:
Serge
2024-01-16 20:53:09 +01:00
parent 6dd4905b95
commit acef2407c7
2 changed files with 21 additions and 44 deletions

View File

@@ -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)