mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 14:11:33 +00:00
Fix extra non-working gamepad appearing to the host
This commit is contained in:
@@ -94,6 +94,12 @@ SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, NvComputer*, int s
|
|||||||
MappingManager mappingManager;
|
MappingManager mappingManager;
|
||||||
mappingManager.applyMappings();
|
mappingManager.applyMappings();
|
||||||
|
|
||||||
|
// Flush gamepad arrival and departure events which may be queued before
|
||||||
|
// starting the gamecontroller subsystem again. This prevents us from
|
||||||
|
// receiving duplicate arrival and departure events for the same gamepad.
|
||||||
|
SDL_FlushEvent(SDL_CONTROLLERDEVICEADDED);
|
||||||
|
SDL_FlushEvent(SDL_CONTROLLERDEVICEREMOVED);
|
||||||
|
|
||||||
// We need to reinit this each time, since you only get
|
// We need to reinit this each time, since you only get
|
||||||
// an initial set of gamepad arrival events once per init.
|
// an initial set of gamepad arrival events once per init.
|
||||||
SDL_assert(!SDL_WasInit(SDL_INIT_GAMECONTROLLER));
|
SDL_assert(!SDL_WasInit(SDL_INIT_GAMECONTROLLER));
|
||||||
@@ -905,6 +911,7 @@ void SdlInputHandler::handleControllerDeviceEvent(SDL_ControllerDeviceEvent* eve
|
|||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
for (; i < MAX_GAMEPADS; i++) {
|
for (; i < MAX_GAMEPADS; i++) {
|
||||||
|
SDL_assert(m_GamepadState[i].controller != controller);
|
||||||
if (m_GamepadState[i].controller == NULL) {
|
if (m_GamepadState[i].controller == NULL) {
|
||||||
// Found an empty slot
|
// Found an empty slot
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user