migrant input: commit abans que gemini destroçe algo

This commit is contained in:
2025-08-04 11:37:46 +02:00
parent 90c080f3e3
commit 050b6716bf
10 changed files with 245 additions and 99 deletions

View File

@@ -435,4 +435,29 @@ bool Input::removeGamepadConfig(const std::string &gamepadName) {
}
return false;
}
std::shared_ptr<Input::Gamepad> Input::findAvailableGamepadByName(const std::string &gamepad_name)
{
// Si no hay gamepads disponibles, devolver gamepad por defecto
if (gamepads_.empty()) {
return nullptr;
}
// Buscar por nombre
for (const auto& gamepad : gamepads_) {
if (gamepad && gamepad->name == gamepad_name) {
return gamepad;
}
}
// Si no se encuentra por nombre, devolver el primer gamepad válido
for (const auto& gamepad : gamepads_) {
if (gamepad) {
return gamepad;
}
}
// Si llegamos aquí, no hay gamepads válidos
return nullptr;
}