diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2022-09-02 11:36:46 +0200 |
---|---|---|
committer | german77 <juangerman-13@hotmail.com> | 2022-09-04 00:52:57 +0200 |
commit | c3b16cf8d32f1925b7a539e9da7e5d630a354be5 (patch) | |
tree | 2fb7fa734be2a0800d74601e58cef9f7f44bd0f4 /src | |
parent | Merge pull request #8843 from Kelebek1/SILENCE_WENCH (diff) | |
download | yuzu-c3b16cf8d32f1925b7a539e9da7e5d630a354be5.tar yuzu-c3b16cf8d32f1925b7a539e9da7e5d630a354be5.tar.gz yuzu-c3b16cf8d32f1925b7a539e9da7e5d630a354be5.tar.bz2 yuzu-c3b16cf8d32f1925b7a539e9da7e5d630a354be5.tar.lz yuzu-c3b16cf8d32f1925b7a539e9da7e5d630a354be5.tar.xz yuzu-c3b16cf8d32f1925b7a539e9da7e5d630a354be5.tar.zst yuzu-c3b16cf8d32f1925b7a539e9da7e5d630a354be5.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/input_common/drivers/sdl_driver.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index de388ec4c..5cc1ccbd9 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp @@ -40,13 +40,13 @@ public: void EnableMotion() { if (sdl_controller) { SDL_GameController* controller = sdl_controller.get(); - if (SDL_GameControllerHasSensor(controller, SDL_SENSOR_ACCEL) && !has_accel) { + has_accel = SDL_GameControllerHasSensor(controller, SDL_SENSOR_ACCEL); + has_gyro = SDL_GameControllerHasSensor(controller, SDL_SENSOR_GYRO); + if (has_accel) { SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_ACCEL, SDL_TRUE); - has_accel = true; } - if (SDL_GameControllerHasSensor(controller, SDL_SENSOR_GYRO) && !has_gyro) { + if (has_gyro) { SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_GYRO, SDL_TRUE); - has_gyro = true; } } } @@ -305,6 +305,7 @@ void SDLDriver::InitJoystick(int joystick_index) { auto joystick = std::make_shared<SDLJoystick>(guid, 0, sdl_joystick, sdl_gamecontroller); PreSetController(joystick->GetPadIdentifier()); SetBattery(joystick->GetPadIdentifier(), joystick->GetBatteryLevel()); + joystick->EnableMotion(); joystick_map[guid].emplace_back(std::move(joystick)); return; } @@ -316,6 +317,7 @@ void SDLDriver::InitJoystick(int joystick_index) { if (joystick_it != joystick_guid_list.end()) { (*joystick_it)->SetSDLJoystick(sdl_joystick, sdl_gamecontroller); + (*joystick_it)->EnableMotion(); return; } @@ -323,6 +325,7 @@ void SDLDriver::InitJoystick(int joystick_index) { auto joystick = std::make_shared<SDLJoystick>(guid, port, sdl_joystick, sdl_gamecontroller); PreSetController(joystick->GetPadIdentifier()); SetBattery(joystick->GetPadIdentifier(), joystick->GetBatteryLevel()); + joystick->EnableMotion(); joystick_guid_list.emplace_back(std::move(joystick)); } |