From ed0f1a91322b29644d477409c9805edad23edefb Mon Sep 17 00:00:00 2001 From: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com> Date: Sun, 25 May 2025 16:08:16 +0200 Subject: [PATCH] Test for XInput --- src/input/controller.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/input/controller.cpp b/src/input/controller.cpp index 911805b13..eae786e44 100644 --- a/src/input/controller.cpp +++ b/src/input/controller.cpp @@ -349,13 +349,9 @@ u32 GameController::Poll() { } u8 GameControllers::GetGamepadIndexFromJoystickId(SDL_JoystickID id) { - auto& controllers = *Common::Singleton::Instance(); - for (int i = 0; i < 4; i++) { - if (SDL_GetGamepadID(controllers[i]->m_sdl_gamepad) == id) { - return controllers[i]->player_index; - } - } - UNREACHABLE_MSG("Handle {} is not registered!", id); + s32 index = SDL_GetGamepadPlayerIndex(SDL_GetGamepadFromID(id)); + LOG_INFO(Input, "Gamepad index: {}", index); + return index; } } // namespace Input