diff options
| author | 2021-12-13 16:50:54 -0800 | |
|---|---|---|
| committer | 2021-12-13 16:50:54 -0800 | |
| commit | ad45963b459d07d04e78f86d3316d7494730e9f9 (patch) | |
| tree | a2e70a6ffad04ec840e4ff3cd581d7a4ec5853fa /src/input_common/drivers/sdl_driver.cpp | |
| parent | Merge pull request #7576 from lioncash/tasenum (diff) | |
| parent | input_engine: Fix typo in TriggerOnAxisChange() parameter name (diff) | |
| download | yuzu-ad45963b459d07d04e78f86d3316d7494730e9f9.tar.gz yuzu-ad45963b459d07d04e78f86d3316d7494730e9f9.tar.xz yuzu-ad45963b459d07d04e78f86d3316d7494730e9f9.zip | |
Merge pull request #7575 from lioncash/input
input_engine: Minor object churn cleanup
Diffstat (limited to 'src/input_common/drivers/sdl_driver.cpp')
| -rw-r--r-- | src/input_common/drivers/sdl_driver.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index 1052ed394..e33a5ff31 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp | |||
| @@ -88,7 +88,7 @@ public: | |||
| 88 | return true; | 88 | return true; |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | BasicMotion GetMotion() { | 91 | const BasicMotion& GetMotion() const { |
| 92 | return motion; | 92 | return motion; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| @@ -367,7 +367,7 @@ void SDLDriver::HandleGameControllerEvent(const SDL_Event& event) { | |||
| 367 | if (joystick->UpdateMotion(event.csensor)) { | 367 | if (joystick->UpdateMotion(event.csensor)) { |
| 368 | const PadIdentifier identifier = joystick->GetPadIdentifier(); | 368 | const PadIdentifier identifier = joystick->GetPadIdentifier(); |
| 369 | SetMotion(identifier, 0, joystick->GetMotion()); | 369 | SetMotion(identifier, 0, joystick->GetMotion()); |
| 370 | }; | 370 | } |
| 371 | } | 371 | } |
| 372 | break; | 372 | break; |
| 373 | } | 373 | } |
| @@ -387,7 +387,7 @@ void SDLDriver::CloseJoysticks() { | |||
| 387 | joystick_map.clear(); | 387 | joystick_map.clear(); |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | SDLDriver::SDLDriver(const std::string& input_engine_) : InputEngine(input_engine_) { | 390 | SDLDriver::SDLDriver(std::string input_engine_) : InputEngine(std::move(input_engine_)) { |
| 391 | if (!Settings::values.enable_raw_input) { | 391 | if (!Settings::values.enable_raw_input) { |
| 392 | // Disable raw input. When enabled this setting causes SDL to die when a web applet opens | 392 | // Disable raw input. When enabled this setting causes SDL to die when a web applet opens |
| 393 | SDL_SetHint(SDL_HINT_JOYSTICK_RAWINPUT, "0"); | 393 | SDL_SetHint(SDL_HINT_JOYSTICK_RAWINPUT, "0"); |
| @@ -491,8 +491,9 @@ std::vector<Common::ParamPackage> SDLDriver::GetInputDevices() const { | |||
| 491 | } | 491 | } |
| 492 | return devices; | 492 | return devices; |
| 493 | } | 493 | } |
| 494 | Common::Input::VibrationError SDLDriver::SetRumble(const PadIdentifier& identifier, | 494 | |
| 495 | const Common::Input::VibrationStatus vibration) { | 495 | Common::Input::VibrationError SDLDriver::SetRumble( |
| 496 | const PadIdentifier& identifier, const Common::Input::VibrationStatus& vibration) { | ||
| 496 | const auto joystick = | 497 | const auto joystick = |
| 497 | GetSDLJoystickByGUID(identifier.guid.Format(), static_cast<int>(identifier.port)); | 498 | GetSDLJoystickByGUID(identifier.guid.Format(), static_cast<int>(identifier.port)); |
| 498 | const auto process_amplitude_exp = [](f32 amplitude, f32 factor) { | 499 | const auto process_amplitude_exp = [](f32 amplitude, f32 factor) { |
| @@ -526,6 +527,7 @@ Common::Input::VibrationError SDLDriver::SetRumble(const PadIdentifier& identifi | |||
| 526 | 527 | ||
| 527 | return Common::Input::VibrationError::None; | 528 | return Common::Input::VibrationError::None; |
| 528 | } | 529 | } |
| 530 | |||
| 529 | Common::ParamPackage SDLDriver::BuildAnalogParamPackageForButton(int port, std::string guid, | 531 | Common::ParamPackage SDLDriver::BuildAnalogParamPackageForButton(int port, std::string guid, |
| 530 | s32 axis, float value) const { | 532 | s32 axis, float value) const { |
| 531 | Common::ParamPackage params{}; | 533 | Common::ParamPackage params{}; |