diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c index f13fec8f4..440105499 100644 --- a/src/joystick/windows/SDL_rawinputjoystick.c +++ b/src/joystick/windows/SDL_rawinputjoystick.c @@ -1473,6 +1473,7 @@ RAWINPUT_HandleStatePacket(SDL_Joystick *joystick, Uint8 *data, int size) for (i = 0; i < nhats; ++i) { HIDP_DATA *item = GetData(ctx->hat_indices[i], ctx->data, data_length); if (item) { + Uint8 hat = SDL_HAT_CENTERED; const Uint8 hat_states[] = { SDL_HAT_CENTERED, SDL_HAT_UP, @@ -1483,6 +1484,7 @@ RAWINPUT_HandleStatePacket(SDL_Joystick *joystick, Uint8 *data, int size) SDL_HAT_DOWN | SDL_HAT_LEFT, SDL_HAT_LEFT, SDL_HAT_UP | SDL_HAT_LEFT, + SDL_HAT_CENTERED, }; ULONG state = item->RawValue; @@ -1490,8 +1492,9 @@ RAWINPUT_HandleStatePacket(SDL_Joystick *joystick, Uint8 *data, int size) #ifdef SDL_JOYSTICK_RAWINPUT_MATCHING match_state = (match_state & ~HAT_MASK) | hat_map[state]; #endif - SDL_PrivateJoystickHat(joystick, i, hat_states[state]); + hat = hat_states[state]; } + SDL_PrivateJoystickHat(joystick, i, hat); } }