Fix haptics not being fired both sides

This commit is contained in:
Kamil Trzciński 2022-12-05 09:29:47 +01:00
parent 0a52c57d59
commit 6173c80bdd
2 changed files with 4 additions and 3 deletions

View file

@ -25,3 +25,4 @@ It does help this project on being supported.
- Allow to change scroll direction
- Debounce controller changes from Steam
- Allow to select between touch keyboard or CTRL+WIN+O
- Fix haptics not being fired both sides

View file

@ -62,11 +62,11 @@ namespace SteamController.Devices
public SDCHapticPacket2() { }
}
private Task? hapticTask;
private Task?[] hapticTask = new Task?[byte.MaxValue];
public bool SendHaptic(byte position, sbyte intensity)
{
if (hapticTask?.IsCompleted == false)
if (hapticTask[position]?.IsCompleted == false)
return false;
var ts = Random.Shared.Next();
@ -87,7 +87,7 @@ namespace SteamController.Devices
try
{
Marshal.StructureToPtr(haptic, handle.AddrOfPinnedObject(), false);
hapticTask = neptuneDevice.RequestFeatureReportAsync(bytes);
hapticTask[position] = neptuneDevice.RequestFeatureReportAsync(bytes);
return true;
}
catch (Exception e)