mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-28 01:49:33 -06:00
Merge pull request #13625 from Dentomologist/sdl_verify_touchpad_present_before_getting_input
SDL: Check if touchpad exists before getting input
This commit is contained in:
@ -362,11 +362,15 @@ public:
|
|||||||
const int touchpad_index = 0;
|
const int touchpad_index = 0;
|
||||||
const int finger_index = 0;
|
const int finger_index = 0;
|
||||||
|
|
||||||
Uint8 state = 0;
|
if (SDL_GameControllerGetNumTouchpads(m_gamecontroller) > touchpad_index &&
|
||||||
SDL_GameControllerGetTouchpadFinger(m_gamecontroller, touchpad_index, finger_index, &state,
|
SDL_GameControllerGetNumTouchpadFingers(m_gamecontroller, touchpad_index) > finger_index)
|
||||||
&m_touchpad_x, &m_touchpad_y, &m_touchpad_pressure);
|
{
|
||||||
m_touchpad_x = m_touchpad_x * 2 - 1;
|
Uint8 state = 0;
|
||||||
m_touchpad_y = m_touchpad_y * 2 - 1;
|
SDL_GameControllerGetTouchpadFinger(m_gamecontroller, touchpad_index, finger_index, &state,
|
||||||
|
&m_touchpad_x, &m_touchpad_y, &m_touchpad_pressure);
|
||||||
|
m_touchpad_x = m_touchpad_x * 2 - 1;
|
||||||
|
m_touchpad_y = m_touchpad_y * 2 - 1;
|
||||||
|
}
|
||||||
|
|
||||||
return Core::DeviceRemoval::Keep;
|
return Core::DeviceRemoval::Keep;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user