SDLInputSource: Log axes/buttons when controller is opened

This commit is contained in:
Stenzek 2024-01-08 15:48:34 +10:00
parent fb3f0f04ed
commit c5c023af5f
No known key found for this signature in database
1 changed files with 5 additions and 0 deletions

View File

@ -705,6 +705,8 @@ bool SDLInputSource::OpenDevice(int index, bool is_gamecontroller)
mark_bind(SDL_GameControllerGetBindForAxis(gcontroller, static_cast<SDL_GameControllerAxis>(i)));
for (size_t i = 0; i < std::size(s_sdl_button_names); i++)
mark_bind(SDL_GameControllerGetBindForButton(gcontroller, static_cast<SDL_GameControllerButton>(i)));
Log_VerbosePrintf("(SDLInputSource) Controller %d has %d axes and %d buttons", player_id, num_axes, num_buttons);
}
else
{
@ -712,6 +714,9 @@ bool SDLInputSource::OpenDevice(int index, bool is_gamecontroller)
const int num_hats = SDL_JoystickNumHats(joystick);
if (num_hats > 0)
cd.last_hat_state.resize(static_cast<size_t>(num_hats), u8(0));
Log_VerbosePrintf("(SDLInputSource) Joystick %d has %d axes, %d buttons and %d hats", player_id,
SDL_JoystickNumAxes(joystick), SDL_JoystickNumButtons(joystick), num_hats);
}
cd.use_game_controller_rumble = (gcontroller && SDL_GameControllerRumble(gcontroller, 0, 0, 0) == 0);