Only send sensor data if sensors are enabled for 8BitDo controllers
This commit is contained in:
@@ -49,6 +49,7 @@ enum
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
bool sensors_supported;
|
bool sensors_supported;
|
||||||
|
bool sensors_enabled;
|
||||||
bool touchpad_01_supported;
|
bool touchpad_01_supported;
|
||||||
bool touchpad_02_supported;
|
bool touchpad_02_supported;
|
||||||
bool rumble_supported;
|
bool rumble_supported;
|
||||||
@@ -202,11 +203,9 @@ static Uint32 HIDAPI_Driver8BitDo_GetJoystickCapabilities(SDL_HIDAPI_Device *dev
|
|||||||
if (ctx->rumble_supported) {
|
if (ctx->rumble_supported) {
|
||||||
caps |= SDL_JOYSTICK_CAP_RUMBLE;
|
caps |= SDL_JOYSTICK_CAP_RUMBLE;
|
||||||
}
|
}
|
||||||
#if 0 // HIDAPI_Driver8BitDo_SetJoystickLED() returns SDL_Unsupported()
|
|
||||||
if (ctx->rgb_supported) {
|
if (ctx->rgb_supported) {
|
||||||
caps |= SDL_JOYSTICK_CAP_RGB_LED;
|
caps |= SDL_JOYSTICK_CAP_RGB_LED;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,6 +223,7 @@ static bool HIDAPI_Driver8BitDo_SetJoystickSensorsEnabled(SDL_HIDAPI_Device *dev
|
|||||||
{
|
{
|
||||||
SDL_Driver8BitDo_Context *ctx = (SDL_Driver8BitDo_Context *)device->context;
|
SDL_Driver8BitDo_Context *ctx = (SDL_Driver8BitDo_Context *)device->context;
|
||||||
if (ctx->sensors_supported) {
|
if (ctx->sensors_supported) {
|
||||||
|
ctx->sensors_enabled = enabled;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return SDL_Unsupported();
|
return SDL_Unsupported();
|
||||||
@@ -352,7 +352,7 @@ static void HIDAPI_Driver8BitDo_HandleStatePacket(SDL_Joystick *joystick, SDL_Dr
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (ctx->sensors_supported) {
|
if (ctx->sensors_enabled) {
|
||||||
Uint64 sensor_timestamp;
|
Uint64 sensor_timestamp;
|
||||||
float values[3];
|
float values[3];
|
||||||
ABITDO_SENSORS *sensors = (ABITDO_SENSORS *)&data[15];
|
ABITDO_SENSORS *sensors = (ABITDO_SENSORS *)&data[15];
|
||||||
|
|||||||
Reference in New Issue
Block a user