mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-21 03:16:54 +02:00
Clamp compute LDS to the device limit and ignore unopenable gamepads
This commit is contained in:
@@ -306,14 +306,20 @@ static void GameEventController([[maybe_unused]] const EventController& f) {
|
||||
|
||||
if (f.added) {
|
||||
auto* pad = SDL_OpenGamepad(f.id);
|
||||
EXIT_NOT_IMPLEMENTED(pad == nullptr);
|
||||
if (pad == nullptr) {
|
||||
LOGF("Controller: ignoring gamepad %d that could not be opened: %s\n", f.id,
|
||||
SDL_GetError());
|
||||
return;
|
||||
}
|
||||
int id = SDL_GetJoystickID(SDL_GetGamepadJoystick(pad));
|
||||
Controller::Connect(id);
|
||||
}
|
||||
|
||||
if (f.removed) {
|
||||
Controller::Disconnect(f.id);
|
||||
SDL_CloseGamepad(SDL_GetGamepadFromID(f.id));
|
||||
if (auto* pad = SDL_GetGamepadFromID(f.id); pad != nullptr) {
|
||||
Controller::Disconnect(f.id);
|
||||
SDL_CloseGamepad(pad);
|
||||
}
|
||||
}
|
||||
|
||||
if (f.down || f.up) {
|
||||
|
||||
Reference in New Issue
Block a user