The TOUCH_STATE struct I used and added into JoyShockLibrary.cs was in a wrong form despite the fact that I directly copied it fromJoyShockLibrary.h @ Line 111. Here's TOUCH_STATE struct declared on that said file:
...and here's that same struct I converted to C# initially:
[StructLayout(LayoutKind.Sequential)]
public struct TOUCH_STATE {
public int t0Id;
public int t1Id;
public bool t0Down;
public bool t1Down;
public float t0X;
public float t0Y;
public float t1X;
public float t1Y;
}
It is already identical, and yet it yields data in a different sequence. I found out later on that the methods that return TOUCH_STATE structs do not contain any values that should be for t1Down.
WORKAROUND SOLUTION
Putting the public bool t1Down; or public float t1Down; at the very bottom of the struct returns proper values for both touches. This is how the C# struct looks now:
[StructLayout(LayoutKind.Sequential)]
public struct MODIFIED_TOUCH_STATE
{
public int t0Id;
public int t1Id;
public bool t0Down;
public float t0X;
public float t0Y;
public float t1X;
public float t1Y;
public float t1Down; // still nothing
}
My tests still don't show any change in value on t1Down after moving it downwards, so I'm thinking there's no value for checking if there's a second touch? I wish to help look into your source code to pinpoint where this problem stems from, but I don't know much about C++. I'm just going to bet that it's within the InputHelpers.cpp of yours.
I'm willing to answer further questions that may help you!
VERSION: Release v2.2.0
ISSUE
The
TOUCH_STATE
struct I used and added intoJoyShockLibrary.cs
was in a wrong form despite the fact that I directly copied it fromJoyShockLibrary.h
@ Line 111. Here's TOUCH_STATE struct declared on that said file:...and here's that same struct I converted to C# initially:
It is already identical, and yet it yields data in a different sequence. I found out later on that the methods that return
TOUCH_STATE
structs do not contain any values that should be fort1Down
.WORKAROUND SOLUTION
Putting the
public bool t1Down;
orpublic float t1Down;
at the very bottom of the struct returns proper values for both touches. This is how the C# struct looks now:My tests still don't show any change in value on
t1Down
after moving it downwards, so I'm thinking there's no value for checking if there's a second touch? I wish to help look into your source code to pinpoint where this problem stems from, but I don't know much about C++. I'm just going to bet that it's within theInputHelpers.cpp
of yours.I'm willing to answer further questions that may help you!