Fixed build warnings

main
Sam Lantinga 2023-07-08 11:16:40 -07:00
parent f047e178b6
commit 7d894dc1c9
2 changed files with 19 additions and 19 deletions

View File

@ -394,7 +394,7 @@ static SDL_bool RAWINPUT_XInputSlotMatches(const WindowsMatchState *state, Uint8
static SDL_bool RAWINPUT_GuessXInputSlot(const WindowsMatchState *state, Uint8 *correlation_id, Uint8 *slot_idx)
{
int user_index;
Uint8 user_index;
int match_count;
*slot_idx = 0;
@ -403,7 +403,7 @@ static SDL_bool RAWINPUT_GuessXInputSlot(const WindowsMatchState *state, Uint8 *
for (user_index = 0; user_index < XUSER_MAX_COUNT; ++user_index) {
if (!xinput_state[user_index].used && RAWINPUT_XInputSlotMatches(state, user_index)) {
++match_count;
*slot_idx = (Uint8)user_index;
*slot_idx = user_index;
/* Incrementing correlation_id for any match, as negative evidence for others being correlated */
*correlation_id = ++xinput_state[user_index].correlation_id;
}
@ -1075,7 +1075,7 @@ static void RAWINPUT_PostUpdate(void)
if (ctx->guide_hack) {
int guide_button = joystick->nbuttons - 1;
SDL_SendJoystickButton(SDL_GetTicksNS(), guide_button_candidate.joystick, guide_button, SDL_PRESSED);
SDL_SendJoystickButton(SDL_GetTicksNS(), guide_button_candidate.joystick, (Uint8)guide_button, SDL_PRESSED);
}
guide_button_candidate.last_joystick = guide_button_candidate.joystick;
}
@ -1085,7 +1085,7 @@ static void RAWINPUT_PostUpdate(void)
if (ctx->guide_hack) {
int guide_button = joystick->nbuttons - 1;
SDL_SendJoystickButton(SDL_GetTicksNS(), joystick, guide_button, SDL_RELEASED);
SDL_SendJoystickButton(SDL_GetTicksNS(), joystick, (Uint8)guide_button, SDL_RELEASED);
}
guide_button_candidate.last_joystick = NULL;
}
@ -1264,7 +1264,7 @@ static int RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index)
int j, count = 1 + (cap->Range.DataIndexMax - cap->Range.DataIndexMin);
for (j = 0; j < count; ++j) {
ctx->button_indices[button_index++] = cap->Range.DataIndexMin + j;
ctx->button_indices[button_index++] = (USHORT)(cap->Range.DataIndexMin + j);
}
} else {
ctx->button_indices[button_index++] = cap->NotRange.DataIndex;
@ -1568,14 +1568,14 @@ static void RAWINPUT_HandleStatePacket(SDL_Joystick *joystick, Uint8 *data, int
}
}
for (i = 0; i < nbuttons; ++i) {
SDL_SendJoystickButton(timestamp, joystick, i, (button_mask & (1 << i)) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, (Uint8)i, (button_mask & (1 << i)) ? SDL_PRESSED : SDL_RELEASED);
}
for (i = 0; i < naxes; ++i) {
HIDP_DATA *item = GetData(ctx->axis_indices[i], ctx->data, data_length);
if (item) {
Sint16 axis = (int)(Uint16)item->RawValue - 0x8000;
SDL_SendJoystickAxis(timestamp, joystick, i, axis);
SDL_SendJoystickAxis(timestamp, joystick, (Uint8)i, axis);
}
}
@ -1603,7 +1603,7 @@ static void RAWINPUT_HandleStatePacket(SDL_Joystick *joystick, Uint8 *data, int
#endif
hat = hat_states[state];
}
SDL_SendJoystickHat(timestamp, joystick, i, hat);
SDL_SendJoystickHat(timestamp, joystick, (Uint8)i, hat);
}
}
@ -1656,8 +1656,8 @@ static void RAWINPUT_HandleStatePacket(SDL_Joystick *joystick, Uint8 *data, int
if (!has_trigger_data)
#endif /* SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS */
{
SDL_SendJoystickAxis(timestamp, joystick, left_trigger, left_value);
SDL_SendJoystickAxis(timestamp, joystick, right_trigger, right_value);
SDL_SendJoystickAxis(timestamp, joystick, (Uint8)left_trigger, left_value);
SDL_SendJoystickAxis(timestamp, joystick, (Uint8)right_trigger, right_value);
}
}
}
@ -1725,7 +1725,7 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
/* It gets left down if we were actually correlated incorrectly and it was released on the WindowsGamingInput
device but we didn't get a state packet. */
if (ctx->guide_hack) {
SDL_SendJoystickButton(0, joystick, guide_button, SDL_RELEASED);
SDL_SendJoystickButton(0, joystick, (Uint8)guide_button, SDL_RELEASED);
}
}
}
@ -1821,7 +1821,7 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
/* It gets left down if we were actually correlated incorrectly and it was released on the XInput
device but we didn't get a state packet. */
if (ctx->guide_hack) {
SDL_SendJoystickButton(0, joystick, guide_button, SDL_RELEASED);
SDL_SendJoystickButton(0, joystick, (Uint8)guide_button, SDL_RELEASED);
}
}
}
@ -1894,11 +1894,11 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
}
if (ctx->guide_hack) {
SDL_SendJoystickButton(timestamp, joystick, guide_button, (xinput_state[ctx->xinput_slot].state.Gamepad.wButtons & XINPUT_GAMEPAD_GUIDE) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, (Uint8)guide_button, (xinput_state[ctx->xinput_slot].state.Gamepad.wButtons & XINPUT_GAMEPAD_GUIDE) ? SDL_PRESSED : SDL_RELEASED);
}
if (ctx->trigger_hack) {
SDL_SendJoystickAxis(timestamp, joystick, left_trigger, ((int)xinput_state[ctx->xinput_slot].state.Gamepad.bLeftTrigger * 257) - 32768);
SDL_SendJoystickAxis(timestamp, joystick, right_trigger, ((int)xinput_state[ctx->xinput_slot].state.Gamepad.bRightTrigger * 257) - 32768);
SDL_SendJoystickAxis(timestamp, joystick, (Uint8)left_trigger, ((int)xinput_state[ctx->xinput_slot].state.Gamepad.bLeftTrigger * 257) - 32768);
SDL_SendJoystickAxis(timestamp, joystick, (Uint8)right_trigger, ((int)xinput_state[ctx->xinput_slot].state.Gamepad.bRightTrigger * 257) - 32768);
}
has_trigger_data = SDL_TRUE;
@ -1945,11 +1945,11 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
}
if (ctx->guide_hack) {
SDL_SendJoystickButton(timestamp, joystick, guide_button, (state->Buttons & GamepadButtons_GUIDE) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, (Uint8)guide_button, (state->Buttons & GamepadButtons_GUIDE) ? SDL_PRESSED : SDL_RELEASED);
}
if (ctx->trigger_hack) {
SDL_SendJoystickAxis(timestamp, joystick, left_trigger, ((int)(state->LeftTrigger * SDL_MAX_UINT16)) - 32768);
SDL_SendJoystickAxis(timestamp, joystick, right_trigger, ((int)(state->RightTrigger * SDL_MAX_UINT16)) - 32768);
SDL_SendJoystickAxis(timestamp, joystick, (Uint8)left_trigger, (Sint16)(((int)(state->LeftTrigger * SDL_MAX_UINT16)) - 32768));
SDL_SendJoystickAxis(timestamp, joystick, (Uint8)right_trigger, (Sint16)(((int)(state->RightTrigger * SDL_MAX_UINT16)) - 32768));
}
has_trigger_data = SDL_TRUE;
}

View File

@ -396,7 +396,7 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeAdde
hr = __x_ABI_CWindows_CGaming_CInput_CIRawGameController_QueryInterface(e, &IID_IRawGameController, (void **)&controller);
if (SUCCEEDED(hr)) {
char *name = NULL;
SDL_JoystickGUID guid;
SDL_JoystickGUID guid = { 0 };
Uint16 bus = SDL_HARDWARE_BUS_USB;
Uint16 vendor = 0;
Uint16 product = 0;