mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-03 00:06:09 +00:00
Fix host virtual gamepads being reconnected during stream startup and causing issues with multiple controllers. Fixes #108
This commit is contained in:
parent
dfcc1ff899
commit
d847b71c86
@ -69,14 +69,10 @@ SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, NvComputer*, int s
|
|||||||
MappingManager mappingManager;
|
MappingManager mappingManager;
|
||||||
mappingManager.applyMappings();
|
mappingManager.applyMappings();
|
||||||
|
|
||||||
if (!m_MultiController) {
|
// Initialize the gamepad mask with currently attached gamepads to avoid
|
||||||
// Player 1 is always present in non-MC mode
|
// causing gamepads to unexpectedly disappear and reappear on the host
|
||||||
m_GamepadMask = 0x1;
|
// during stream startup as we detect currently attached gamepads one at a time.
|
||||||
}
|
m_GamepadMask = getAttachedGamepadMask();
|
||||||
else {
|
|
||||||
// Otherwise, detect gamepads on the fly
|
|
||||||
m_GamepadMask = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_zero(m_GamepadState);
|
SDL_zero(m_GamepadState);
|
||||||
SDL_zero(m_TouchDownEvent);
|
SDL_zero(m_TouchDownEvent);
|
||||||
@ -700,7 +696,9 @@ void SdlInputHandler::handleControllerDeviceEvent(SDL_ControllerDeviceEvent* eve
|
|||||||
|
|
||||||
// Add this gamepad to the gamepad mask
|
// Add this gamepad to the gamepad mask
|
||||||
if (m_MultiController) {
|
if (m_MultiController) {
|
||||||
SDL_assert(!(m_GamepadMask & (1 << state->index)));
|
// NB: Don't assert that it's unset here because we will already
|
||||||
|
// have the mask set for initially attached gamepads to avoid confusing
|
||||||
|
// apps running on the host.
|
||||||
m_GamepadMask |= (1 << state->index);
|
m_GamepadMask |= (1 << state->index);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user