mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-14 22:05:59 +00:00
Implemented SendEffect for Steam Controllers
This commit is contained in:
@@ -296,7 +296,7 @@ static int WriteSegmentToSteamControllerPacketAssembler(SteamControllerPacketAss
|
|||||||
|
|
||||||
#define BLE_MAX_READ_RETRIES 8
|
#define BLE_MAX_READ_RETRIES 8
|
||||||
|
|
||||||
static int SetFeatureReport(SDL_HIDAPI_Device *dev, unsigned char uBuffer[65], int nActualDataLen)
|
static int SetFeatureReport(SDL_HIDAPI_Device *dev, const unsigned char uBuffer[65], int nActualDataLen)
|
||||||
{
|
{
|
||||||
int nRet = -1;
|
int nRet = -1;
|
||||||
|
|
||||||
@@ -305,7 +305,7 @@ static int SetFeatureReport(SDL_HIDAPI_Device *dev, unsigned char uBuffer[65], i
|
|||||||
if (dev->is_bluetooth) {
|
if (dev->is_bluetooth) {
|
||||||
int nSegmentNumber = 0;
|
int nSegmentNumber = 0;
|
||||||
uint8_t uPacketBuffer[MAX_REPORT_SEGMENT_SIZE];
|
uint8_t uPacketBuffer[MAX_REPORT_SEGMENT_SIZE];
|
||||||
unsigned char *pBufferPtr = uBuffer + 1;
|
const unsigned char *pBufferPtr = uBuffer + 1;
|
||||||
|
|
||||||
if (nActualDataLen < 1) {
|
if (nActualDataLen < 1) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1243,6 +1243,12 @@ static bool HIDAPI_DriverSteam_SetJoystickLED(SDL_HIDAPI_Device *device, SDL_Joy
|
|||||||
|
|
||||||
static bool HIDAPI_DriverSteam_SendJoystickEffect(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, const void *data, int size)
|
static bool HIDAPI_DriverSteam_SendJoystickEffect(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, const void *data, int size)
|
||||||
{
|
{
|
||||||
|
if (size == 65) {
|
||||||
|
if (SetFeatureReport(device, data, size) < 0) {
|
||||||
|
return SDL_SetError("Couldn't write feature report");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return SDL_Unsupported();
|
return SDL_Unsupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user