diff options
| author | 2021-10-30 22:23:10 -0500 | |
|---|---|---|
| committer | 2021-11-24 20:30:26 -0600 | |
| commit | 2b1b0c2a30e242b08ec120e09803ec54d5445703 (patch) | |
| tree | 9a10400a7e4403b288eee3aae8a52f1d5be912de /src/input_common/drivers/sdl_driver.cpp | |
| parent | input_common: Revert deleted TAS functions (diff) | |
| download | yuzu-2b1b0c2a30e242b08ec120e09803ec54d5445703.tar.gz yuzu-2b1b0c2a30e242b08ec120e09803ec54d5445703.tar.xz yuzu-2b1b0c2a30e242b08ec120e09803ec54d5445703.zip | |
kraken: Address comments from review
start lion review
Diffstat (limited to '')
| -rw-r--r-- | src/input_common/drivers/sdl_driver.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index 53e282ef3..1e3741e0f 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp | |||
| @@ -92,7 +92,7 @@ public: | |||
| 92 | return motion; | 92 | return motion; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | bool RumblePlay(const Input::VibrationStatus vibration) { | 95 | bool RumblePlay(const Common::Input::VibrationStatus vibration) { |
| 96 | constexpr u32 rumble_max_duration_ms = 1000; | 96 | constexpr u32 rumble_max_duration_ms = 1000; |
| 97 | if (sdl_controller) { | 97 | if (sdl_controller) { |
| 98 | return SDL_GameControllerRumble( | 98 | return SDL_GameControllerRumble( |
| @@ -515,8 +515,8 @@ std::vector<Common::ParamPackage> SDLDriver::GetInputDevices() const { | |||
| 515 | } | 515 | } |
| 516 | return devices; | 516 | return devices; |
| 517 | } | 517 | } |
| 518 | Input::VibrationError SDLDriver::SetRumble(const PadIdentifier& identifier, | 518 | Common::Input::VibrationError SDLDriver::SetRumble(const PadIdentifier& identifier, |
| 519 | const Input::VibrationStatus vibration) { | 519 | const Common::Input::VibrationStatus vibration) { |
| 520 | const auto joystick = | 520 | const auto joystick = |
| 521 | GetSDLJoystickByGUID(identifier.guid.Format(), static_cast<int>(identifier.port)); | 521 | GetSDLJoystickByGUID(identifier.guid.Format(), static_cast<int>(identifier.port)); |
| 522 | const auto process_amplitude_exp = [](f32 amplitude, f32 factor) { | 522 | const auto process_amplitude_exp = [](f32 amplitude, f32 factor) { |
| @@ -527,7 +527,7 @@ Input::VibrationError SDLDriver::SetRumble(const PadIdentifier& identifier, | |||
| 527 | f32 factor = 0.35f; | 527 | f32 factor = 0.35f; |
| 528 | 528 | ||
| 529 | // If vibration is set as a linear output use a flatter value | 529 | // If vibration is set as a linear output use a flatter value |
| 530 | if (vibration.type == Input::VibrationAmplificationType::Linear) { | 530 | if (vibration.type == Common::Input::VibrationAmplificationType::Linear) { |
| 531 | factor = 0.5f; | 531 | factor = 0.5f; |
| 532 | } | 532 | } |
| 533 | 533 | ||
| @@ -536,19 +536,19 @@ Input::VibrationError SDLDriver::SetRumble(const PadIdentifier& identifier, | |||
| 536 | factor = 1.0f; | 536 | factor = 1.0f; |
| 537 | } | 537 | } |
| 538 | 538 | ||
| 539 | const Input::VibrationStatus new_vibration{ | 539 | const Common::Input::VibrationStatus new_vibration{ |
| 540 | .low_amplitude = process_amplitude_exp(vibration.low_amplitude, factor), | 540 | .low_amplitude = process_amplitude_exp(vibration.low_amplitude, factor), |
| 541 | .low_frequency = vibration.low_frequency, | 541 | .low_frequency = vibration.low_frequency, |
| 542 | .high_amplitude = process_amplitude_exp(vibration.high_amplitude, factor), | 542 | .high_amplitude = process_amplitude_exp(vibration.high_amplitude, factor), |
| 543 | .high_frequency = vibration.high_frequency, | 543 | .high_frequency = vibration.high_frequency, |
| 544 | .type = Input::VibrationAmplificationType::Exponential, | 544 | .type = Common::Input::VibrationAmplificationType::Exponential, |
| 545 | }; | 545 | }; |
| 546 | 546 | ||
| 547 | if (!joystick->RumblePlay(new_vibration)) { | 547 | if (!joystick->RumblePlay(new_vibration)) { |
| 548 | return Input::VibrationError::Unknown; | 548 | return Common::Input::VibrationError::Unknown; |
| 549 | } | 549 | } |
| 550 | 550 | ||
| 551 | return Input::VibrationError::None; | 551 | return Common::Input::VibrationError::None; |
| 552 | } | 552 | } |
| 553 | Common::ParamPackage SDLDriver::BuildAnalogParamPackageForButton(int port, std::string guid, | 553 | Common::ParamPackage SDLDriver::BuildAnalogParamPackageForButton(int port, std::string guid, |
| 554 | s32 axis, float value) const { | 554 | s32 axis, float value) const { |