Cleaned up various type conversion issues
This makes sure SDL_PixelFormatEnum flows through the internal code correctly, as well as fixing a number of other minor issues.
This commit is contained in:
@@ -204,7 +204,7 @@ static SDL_bool HIDAPI_DriverShield_OpenJoystick(SDL_HIDAPI_Device *device, SDL_
|
||||
|
||||
static int HIDAPI_DriverShield_SendNextRumble(SDL_HIDAPI_Device *device)
|
||||
{
|
||||
SDL_DriverShield_Context *ctx = device->context;
|
||||
SDL_DriverShield_Context *ctx = (SDL_DriverShield_Context *)device->context;
|
||||
Uint8 rumble_data[3];
|
||||
|
||||
if (!ctx->rumble_update_pending) {
|
||||
@@ -235,7 +235,7 @@ static int HIDAPI_DriverShield_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joy
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
SDL_DriverShield_Context *ctx = device->context;
|
||||
SDL_DriverShield_Context *ctx = (SDL_DriverShield_Context *)device->context;
|
||||
|
||||
/* The rumble motors are quite intense, so tone down the intensity like the official driver does */
|
||||
ctx->left_motor_amplitude = low_frequency_rumble >> 11;
|
||||
@@ -268,7 +268,7 @@ static int HIDAPI_DriverShield_SetJoystickLED(SDL_HIDAPI_Device *device, SDL_Joy
|
||||
|
||||
static int HIDAPI_DriverShield_SendJoystickEffect(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, const void *data, int size)
|
||||
{
|
||||
const Uint8 *data_bytes = data;
|
||||
const Uint8 *data_bytes = (const Uint8 *)data;
|
||||
|
||||
if (size > 1) {
|
||||
/* Single command byte followed by a variable length payload */
|
||||
|
||||
@@ -128,6 +128,14 @@ typedef struct
|
||||
Uint8 ucNExtensionBytes;
|
||||
} WiiButtonData;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Uint16 min;
|
||||
Uint16 max;
|
||||
Uint16 center;
|
||||
Uint16 deadzone;
|
||||
} StickCalibrationData;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SDL_HIDAPI_Device *device;
|
||||
@@ -147,13 +155,7 @@ typedef struct
|
||||
Uint64 m_ulNextMotionPlusCheck;
|
||||
SDL_bool m_bDisconnected;
|
||||
|
||||
struct StickCalibrationData
|
||||
{
|
||||
Uint16 min;
|
||||
Uint16 max;
|
||||
Uint16 center;
|
||||
Uint16 deadzone;
|
||||
} m_StickCalibrationData[6];
|
||||
StickCalibrationData m_StickCalibrationData[6];
|
||||
} SDL_DriverWii_Context;
|
||||
|
||||
static void HIDAPI_DriverWii_RegisterHints(SDL_HintCallback callback, void *userdata)
|
||||
@@ -857,7 +859,7 @@ static int HIDAPI_DriverWii_SetJoystickSensorsEnabled(SDL_HIDAPI_Device *device,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void PostStickCalibrated(Uint64 timestamp, SDL_Joystick *joystick, struct StickCalibrationData *calibration, Uint8 axis, Uint16 data)
|
||||
static void PostStickCalibrated(Uint64 timestamp, SDL_Joystick *joystick, StickCalibrationData *calibration, Uint8 axis, Uint16 data)
|
||||
{
|
||||
Sint16 value = 0;
|
||||
if (!calibration->center) {
|
||||
@@ -1366,7 +1368,7 @@ static void HandleStatus(SDL_DriverWii_Context *ctx, SDL_Joystick *joystick)
|
||||
|
||||
static void HandleResponse(SDL_DriverWii_Context *ctx, SDL_Joystick *joystick)
|
||||
{
|
||||
EWiiInputReportIDs type = ctx->m_rgucReadBuffer[0];
|
||||
EWiiInputReportIDs type = (EWiiInputReportIDs)ctx->m_rgucReadBuffer[0];
|
||||
WiiButtonData data;
|
||||
SDL_assert(type == k_eWiiInputReportIDs_Acknowledge || type == k_eWiiInputReportIDs_ReadMemory);
|
||||
SDL_zero(data);
|
||||
@@ -1473,7 +1475,7 @@ static void HandleButtonPacket(SDL_DriverWii_Context *ctx, SDL_Joystick *joystic
|
||||
|
||||
static void HandleInput(SDL_DriverWii_Context *ctx, SDL_Joystick *joystick)
|
||||
{
|
||||
EWiiInputReportIDs type = ctx->m_rgucReadBuffer[0];
|
||||
EWiiInputReportIDs type = (EWiiInputReportIDs)ctx->m_rgucReadBuffer[0];
|
||||
|
||||
/* Set up for handling input */
|
||||
ctx->timestamp = SDL_GetTicksNS();
|
||||
|
||||
Reference in New Issue
Block a user