From 1d9c4435f7806e4b8229a5c8ff5514977909129c Mon Sep 17 00:00:00 2001 From: Kaydax Date: Thu, 14 May 2026 19:30:11 -0400 Subject: [PATCH] Fix CI erros by using SDL_JoystickID instead of int --- src/input_common/drivers/sdl_driver.cpp | 16 ++++++++-------- src/input_common/drivers/sdl_driver.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index d8057a8714..c9bfb434b1 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp @@ -479,18 +479,18 @@ std::shared_ptr SDLDriver::GetSDLJoystickByGamepadID(SDL_JoystickID return *vec_it; } -void SDLDriver::InitJoystick(int joystick_index) { - SDL_Joystick* sdl_joystick = SDL_OpenJoystick(joystick_index); +void SDLDriver::InitJoystick(SDL_JoystickID joystick_id) { + SDL_Joystick* sdl_joystick = SDL_OpenJoystick(joystick_id); SDL_Gamepad* sdl_gamecontroller = nullptr; int battery_percent = -1; SDL_PowerState battery_state = SDL_POWERSTATE_UNKNOWN; - if (SDL_IsGamepad(joystick_index)) { - sdl_gamecontroller = SDL_OpenGamepad(joystick_index); + if (SDL_IsGamepad(joystick_id)) { + sdl_gamecontroller = SDL_OpenGamepad(joystick_id); } if (!sdl_joystick) { - LOG_ERROR(Input, "Failed to open joystick {}", joystick_index); + LOG_ERROR(Input, "Failed to open joystick {}", joystick_id); return; } @@ -501,7 +501,7 @@ void SDLDriver::InitJoystick(int joystick_index) { if (Settings::values.enable_joycon_driver) { if (guid.uuid[5] == 0x05 && guid.uuid[4] == 0x7e && (guid.uuid[8] == 0x06 || guid.uuid[8] == 0x07)) { - LOG_WARNING(Input, "Preferring joycon driver for device index {}", joystick_index); + LOG_WARNING(Input, "Preferring joycon driver for device index {}", joystick_id); SDL_CloseJoystick(sdl_joystick); return; } @@ -509,7 +509,7 @@ void SDLDriver::InitJoystick(int joystick_index) { if (Settings::values.enable_procon_driver) { if (guid.uuid[5] == 0x05 && guid.uuid[4] == 0x7e && guid.uuid[8] == 0x09) { - LOG_WARNING(Input, "Preferring joycon driver for device index {}", joystick_index); + LOG_WARNING(Input, "Preferring joycon driver for device index {}", joystick_id); SDL_CloseJoystick(sdl_joystick); return; } @@ -703,7 +703,7 @@ SDLDriver::SDLDriver(std::string input_engine_) : InputEngine(std::move(input_en SDL_JoystickID* joysticks = SDL_GetJoysticks(&joystick_count); if (joysticks != nullptr) { for (int i = 0; i < joystick_count; ++i) { - InitJoystick(static_cast(joysticks[i])); + InitJoystick(joysticks[i]); } SDL_free(joysticks); } diff --git a/src/input_common/drivers/sdl_driver.h b/src/input_common/drivers/sdl_driver.h index 643929625c..bf4a45e83d 100644 --- a/src/input_common/drivers/sdl_driver.h +++ b/src/input_common/drivers/sdl_driver.h @@ -70,7 +70,7 @@ public: bool IsVibrationEnabled(const PadIdentifier& identifier) override; private: - void InitJoystick(int joystick_index); + void InitJoystick(SDL_JoystickID joystick_id); void CloseJoystick(SDL_Joystick* sdl_joystick); /// Needs to be called before SDL_QuitSubSystem.